After the attack by primarily Saudi Arabians on the United States on September 11, 2001, the US successfully steered the national response against the Saudis toward the Afghans. At the time, it reminded me of a type of "wag the dog" scenario because Saudis at all levels of the Kingdom of Saudi Arabia worked with the terrorists who hijacked airliners in order to make their mission successful.**
**It's incredibly ironic that this attack by Saudis was focused against an America that supported the Israelis and today the Saudis are making common cause with Israel against the Islamic Republic of Iran, which is racing to obtain a nuclear arsenal that they plan to unleash on Israel, the Saudis (and the US if they can pull it off).
At the time it was unseemly for the US to retaliate against the Saudis and seize their oil fields for our own use (nuke their ass and steal their gas scenario).
Thus, the US invaded Afghanistan, buoyed up with international sympathy against Al Qaeda. Within a year after the shackles were removed from the US Intelligence Community, al Qaeda had renounced its mission to establish a global caliphate. They redirected their efforts to regional, loosely affiliated insurgent groups bent on domination of the regions where they live in the Philippines, Malaysia, and in Africa predominantly.
Meanwhile, the US pursued a policy of Afghan pacification even though the Afghan resistance was made up of splinter groups such as Taliban (a proxy for Pakistani national interests), Haqqani, Hezb-e Isalmi, Taj Mir Jawad, (and the Afghan National Army), most of which had only the loosest affiliation with al Qaeda. Twelve years and $680 billion later with no end in sight, the US is on track to leave Afghanistan to the Afghans, following in the wake of Alexander the Great, the United Kingdom, and the Soviet Union.
And once the US is gone and the Afghans don't have a unifying point for their hatred, they will resort again to internecine warfare, for which they have been famous for at least 6,000 years.
Why did the US stay in Afghanistan so long?
War is a racket, and because of that, it's been good for American corporations and thus has provided a mechanism to prop up the middle-class who provide everything from bullets and bandaids to turkey dinners and shoestrings for combat boots.
Maybe by next Christmas we will be gone from there, and at least $700 billion poorer -- but gone.