Why did we go to war in Afghanistan 20 years ago? Because of Sept. 11, 2001.

The U.S. was attacked on its own soil — by four planes piloted by al-Qaida adherents crashing into the twin towers in New York City, the Pentagon and a field near Shanksville, Penn., diverted from its target of the U.S. Capitol — for the first time since Pearl Harbor.

Some 2,960 people were killed and 25,000 were injured. We took the war to them — to Afghanistan where the Taliban gave their allies al-Qaida safe haven. It was the only thing we could have done.

Why did we stay in Afghanistan, and stay for so long? Because, although we answered the enemy, and managed to contain them, we could never fully destroy the Taliban. And we could never fully secure a non-Taliban government.

It seemed too risky to walk away. There never seemed to be a right time. And the U.S. forces remaining there were minimal. But at some point our 20-year involvement — spanning four U.S. presidencies — had to end, and President Joe Biden has decided that time is now, without conditions. Former President Donald Trump was on his way to the same decision, and for the same reasons.

• We have done what we can do, and the Afghans must now govern and protect themselves.

• It is not possible to finally and totally defeat enemies like the Taliban and al-Qaida. The battle of this nation against terrorists is existential. That battle will always be a part of foreign and military policy, and attention to it will ebb and flow according to the degree of threat, but it cannot be the only or even the central focus.

• The world has changed. While our terrorist enemies have been contained, new and more ominous enemies — Russia, China and Iran, quite possibly in coalition — are knocking at our door.

• There is no significant threat to the U.S. coming from Afghanistan at this time. If that changes, and the current Afghanistan government falls, and terrorists begin to reassemble and take hold and build cells there, we have the options of special forces and air power to protect ourselves.

One more thing should be said: Most of us have never known war and know nothing of a soldier's life. Before we ask someone to risk life and limb for the country, we ought to be sure the stakes are worth it and that some higher, or at least measured, success is possible. We could say that 20 years ago. Not now.

The president made the right call.

FROM AN EDITORIAL IN THE PITTSBURGH POST-GAZETTE