Afghan Chief Executive Abdullah Abdullah, center, speaks during a press conference in Kabul, Afghanistan, Monday, Feb. 4, 2019. Credit: Rahmat Gul | AP

“The Taliban have committed, to our satisfaction, to do what is necessary that would prevent Afghanistan from ever becoming a platform for international terrorist groups or individuals,” Zalmay Khalilzad, the U.S. official in charge of Afghanistan peace talks, said on Tuesday. So why didn’t the United States have this discussion with the Taliban 17 years ago, in October 2001?

The next steps are setting dates for the final American withdrawal from Afghanistan (in around 18 months) and opening direct talks between the U.S.-backed Afghan government and the Taliban. There is still much to do, but this could work.

So congratulations to Donald Trump — and shame on the Washington analysts and experts who could never bring themselves to recommend just ending America’s longest-ever war. Some of them are the same people who didn’t realize 17 years ago that these talks should have happened then.

The U.S. invasion of Afghanistan in October 2001 was always about 9/11 and nothing else. The country was targeted because the Taliban, who had come to power five years before, had allowed Osama bin Laden and his band of Islamist extremists to set up a base in Afghanistan, and they were assumed to be implicated in the horrendous attacks on New York and Washington.

That assumption was almost certainly wrong. The Taliban had come to power in 1996 after a 10-year war against the Soviet invaders and the seven-year civil war that followed. They had been a long time out in the hills, and they were really enjoying power.

They mutilated people for small offences and executed them for slightly bigger ones (most of which were not offences at all in other Muslim countries). And they took absolutely no interest in the rest of the world. Under the Taliban, Afghanistan really didn’t have a foreign policy at all.

But the leader of the regime, Mullah Omar, was a personal friend of Osama bin Laden, whom he had met in Pakistan in the 1980s. (Both men were then involved in the war against the Soviet occupation.)

So when bin Laden was forced out of his refuge in Sudan by the Clinton administration in 1996, Omar let him set up camp in southern Afghanistan – and told him not to carry out political activities on Afghan soil. Bin Laden abused that hospitality, and approved the 9/11 attacks from there. (The actual planning was mostly done in Germany.)

Did Mullah Omar have anything to do with the attacks? Did he even know about them in advance? Try to imagine the telephone conversation. (Bin Laden didn’t speak Pashto, but Omar did speak Arabic.)

“Omar, habibi, it’s Osama. How are the wives and children?”

“Not bad, thanks. Yours?”

“Listen, Omar, I’m giving you a heads-up. Next week my guys are going to attack the United States and kill a few thousand Americans, and I’m afraid they’re going to blame you too. So you’ll get invaded and overthrown, and your Taliban guys will have to spend another ten years in the hills being hunted by gunships. But it’s in a good cause. I hope you’re OK with that.”

“Sure, Osama. Good luck with it.”

I’m pretty sure that conversation never happened. Why would Osama bin Laden tell Mullah Omar about the attack in advance, and run the risk that he wasn’t OK with it? Most of the Taliban would certainly have been outraged by the mortal danger bin Laden was exposing them to.

Could the U.S. have persuaded the Taliban to hand bin Laden over in order not to be invaded and driven from power? Maybe you couldn’t have persuaded Mullah Omar, but many of the younger leaders were really not looking forward to being bombed out of the cities and chased back into the hills.

Why wasn’t it at least tried? Probably because there was a strong need to “kick ass” in the United States. Such a horrible crime couldn’t be answered with mere diplomacy and legal proceedings. What was needed was bloody vengeance and catharsis. So Afghanistan got invaded, and several hundred thousand people died in the next 17 years.

And now they are finally negotiating the very same deal with the Taliban that could probably have been made in 2001. It would have saved a lot of time.

Gwynne Dyer’s new book is “Growing Pains: The Future of Democracy (and Work).”