ARTICLE AD BOX
By Frank Gardner
BBC security correspondent
What lessons, if any, have been learned from the 20 years of fighting terrorism across the world? What has worked and what hasn't? And today, as Afghanistan is once more ruled by the movement that sheltered al-Qaeda, are we any wiser than we were on the morning of 11 September 2001?
For an America reeling from the worst ever terrorist attack on the continental USA, the world was seen by some in sharp contrast. There were the good guys versus the bad guys. "Every nation, every region," declared President George W Bush, nine days after the 9/11 attacks, "now has a decision to make. Either you are with us or you are with the terrorists".
A so-called "War on Terror" had been declared. It has since led to the invasion of Afghanistan, then Iraq, to the rise of Isis and the proliferation of Iranian-backed militias across the Middle East, and the deaths of thousands of servicemen and women and many more civilians.
Terrorism has not been eliminated - every major European country has suffered attacks in recent years - but there have been successes too. To date, there has never been an attack approaching the scale of 9/11. Al-Qaeda's bases in Afghanistan were destroyed, its leaders hunted down in Pakistan. The self-declared Isis caliphate that terrorised much of Syria and Iraq has been dismantled.
The list below is doubtless contentious and it is far from comprehensive. It is based on my own observations of covering this subject across the Middle East, Afghanistan, Washington and Guantanamo Bay.
1. Share vital intelligence
The clues were there but nobody joined up the dots in time. In the months leading up to 9/11, America's two primary intelligence agencies, the FBI and the CIA, were both aware that some kind of plot was in the wind.
But such was the rivalry between domestic and overseas intelligence-gathering that they kept what they knew to themselves. Since then, the 9/11 Commission Report has exhaustively trawled through the mistakes made and major improvements have been made.
Visiting the US National Counter Terrorism Centre (NCTC) in Virginia in 2006, I was shown how 17 US agencies now pooled their intelligence on a daily basis.
Britain set up its own fusion centre: the Joint Terrorism Analysis Centre (JTAC) where dozens of specialists from MI5, MI6, Defence, Transport, Health and other areas all sit together inside one building on London's Embankment, providing a continual assessment of the ongoing terror threat to UK nationals at home and abroad.
But the system is not perfect. Two years after the JTAC was established al-Qaeda carried out the 7/7 London bombings, using British nationals to kill more than 50 people. A massive plot to bomb multiple airliners in mid-flight was averted the following year with the help of Pakistan but Britain still suffered multiple attacks in 2017 including the Manchester bombing.
So even good intelligence-gathering and sharing can fail to prevent attacks if the wrong decisions are taken on prioritisation of tasks.
The 2015 Bataclan attack in Paris, which killed 130 people and for which the trial is currently under way, was partly the result of a failure by European authorities to share timely intelligence across borders.
2. Define the mission and don't get distracted
Of all the many reasons why Afghanistan has reverted to Taliban rule, one stands out: the US-led invasion of Iraq in 2003. This ill-fated decision became a massive distraction to what was going on in Afghanistan.
Many US and British Special Forces, who had been successfully hunting down al-Qaeda operatives and working with Afghan partners to keep Taliban insurgents on the back foot, were withdrawn and sent to Iraq instead.
This allowed the Taliban and others to regroup and come back stronger. By November 2003, when I visited a US infantry outpost in Afghanistan's Paktika province, Americans were already describing their mission there as "Op Forgotten".
It is easy to forget that the original mission in Afghanistan was clear-cut and well-executed. After the Taliban rulers refused to hand over the perpetrators, the US teamed up with the Northern Alliance (Afghans opposed to the Taliban) to successfully drive out both the Taliban and al-Qaeda.
But in the years that followed the mission then got diluted, spinning off in numerous directions.
Life improved immeasurably during that time for most Afghans but billions of dollars spent on "nation building" have been squandered through corruption and waste.
3. Choose your partners carefully
Britain's partnering with its closest ally, the US, in the 2003 invasion of Iraq meant that the UK was the junior partner in nearly all the key decisions that followed during the subsequent occupation.
Urgent pleas not to disband the Iraqi army or ban all members of the Baath party from government roles were ignored or overruled. The result was a catastrophic alliance between disgruntled and newly unemployed Iraqi military and intelligence officers with fanatical jihadists. This became Isis.
The collective panic that followed 9/11 meant that US and British intelligence ended up cooperating with certain regimes with appalling human rights records. These chickens came home to roost.
For example, after Colonel Gaddafi's hideous regime in Libya was overthrown in 2011 journalists found a letter from a senior MI6 officer to his Libyan counterpart that discussed the extradition of an Islamist dissident to face arrest and mistreatment.
Today, violent jihadism is most resurgent in the poorly governed or ungoverned parts of Africa, posing a problem for who exactly the West should partner with.
4. Respect human rights or lose the moral high ground
Time and again people in the Middle East have told me: "We may not have liked US foreign policy but we always respected its rule of law. Until Guantanamo Bay."
Rounding up suspects "on the battlefield" - including in a few cases innocent civilians who had been sold for a bounty - and then wrapping them in nappies, goggles and earmuffs to be transported halfway across the world to a US naval detention centre on Cuba did untold damage to America and the West's reputation.
Detention without trial was something that happened in autocratic countries back home. Arabs did not expect it of the US.
Worse was to follow, with revelations of "enhanced interrogation", waterboarding and other mistreatment at CIA black sites where suspected terrorists simply disappeared. The Obama presidency put a stop to this but the damage was done.
5. Have an exit plan
The western interventions that preceded 9/11 were relatively quick and simple by comparison. Sierre Leone, Kosovo, even the Desert Storm campaign of 1991 - all had a finite ending.
But the US-led invasions of Afghanistan and then Iraq have resulted in what have been called "the forever wars". No one involved back in 2001 or 2003 envisaged that they would still be there two decades later. Put simply, the West did not understand what it was getting into and there was no realistic exit plan.
There is no doubt that if the West had not displaced the Taliban and Al-Qaida in Afghanistan in 2001 then more attacks from there would have ensued. The counter-terrorism mission in that country was not a failure but the nation-building one was never completed.
And today, the one abiding image most people will take away is that of desperate Afghans running alongside a departing USAF C17 transport, trying to escape the country the West has now all but abandoned.