The speed and extent of the Afghan military collapse has stunned many observers including US President Joe Biden's administration, which has ordered the Pentagon to pull an about-face and temporarily deploy 3,000 troops to Kabul right as America was supposed to be ending its longest war.
But the cascading losses for Afghanistan’s security forces and a seemingly imminent Taliban march on Kabul were largely predictable and underscore the shortcomings of western counterinsurgency doctrine, experts say.
A similar rout occurred in Iraq in 2014 -- three years after the US had ended operations there -- when ISIS rampaged across the country, committing sectarian atrocities as they went.
Iraqi security forces had benefited from years of western training and equipping as well as billions of dollars in funding, yet they failed their first big battlefield test, often giving up without ever firing a shot as ISIS attacked. The US military had to return to Iraq to help vanquish the extremists.
“The collapse of the Iraqi security forces in 2014 should have been a warning to the US and Nato that it was very possible the same thing would happen in Afghanistan -- but they never internalised the lessons,” said Bill Roggio, senior fellow at the Foundation for the Defence of Democracies.
US-led military efforts in both Iraq and Afghanistan focused on trying to build national forces that loosely mirrored western militaries, with a centralised command structure and ground units that were often reliant on close-air support.
The Pentagon would boast of the nascent armies’ growing effectiveness while understating their reliance on western trainers, air power and cash to spur them on.
“We gave them weapons, we gave them an organisation and all the trappings of a western military, but they weren't prepared to fight like a western military," Mr Roggio said.
In its push to build mini, US-style militaries, the Pentagon gave Black Hawk helicopters to the Afghan air force and M1 Abrams tanks to Iraq, even though such gear is notoriously tough to maintain without regular servicing from US troops or contractors.
ISIS seized donated US Humvees and military gear from Iraqi security forces; now the Taliban are doing the same thing in Afghanistan.
Dan Grazier, a former Marine Corps captain who served in Iraq and Afghanistan, wrote a paper in 2020 in which he argued that providing a foreign government with security forces it cannot support independently or that do not match its security needs sets that country up for failure.
He pointed to Vietnam, Iraq and Afghanistan as wars in which US efforts to build local militaries fell short.
“The United States does not have a very good track record of doing this,” Mr Grazier, who is now a defence researcher at the nonpartisan Project On Government Oversight, told The National.
“We’ve already seen the Iraqi army collapse and now we are in the process of watching the Afghan army collapse, so if that isn’t evidence of why we should stay out of these things, I don’t know what is.”
Another major driver of Iraqi and Afghan militaries' failure has been the endemic corruption in both countries. On paper, Afghanistan's 300,000 troops and police vastly outnumber the Taliban's 75,000 or so fighters, but numerical advantages matter little when soldiers won't fight.
Afghanistan analysts have warned of the corrosive impacts of corruption for years. Foot soldiers would go months with no pay while commanders pocketed their salaries and that of “ghost soldiers” who didn't exist.
The central government in Kabul has been woefully ineffective at provisioning Afghan forces with food and ammunition, and has repeatedly failed to send backup to units under attack.
In recent years, young recruits were often sent to remote posts where they became sitting ducks for Taliban attacks just so a local politician could fly the Afghan flag over his fiefdom.
All of this eroded the motivation of Afghan forces to stand up to the Taliban advance.
Charles Lister, a senior fellow and director of the Syria and counter-terrorism programmes at the Middle East Institute, said the key factor in the Afghan military's collapse is the rapid withdrawal by US and Nato forces.
“The most underappreciated element here is the morale boost, the confidence that came with knowing that US and Nato forces were on the ground, they had the back of Afghan security forces," Mr Lister said.
"When that’s not there anymore, the only source of morale that Afghan forces can rely on is their central government and clearly we are seeing that that is not enough.”
Another factor to consider is the "unifying power of jihadist ideology", Mr Lister added. It "repeatedly proves itself more capable as a mobiliser when facing a corrupt, disunited government."
The US withdrawal from Afghanistan was first agreed to last year by then-president Donald Trump, who signed off on a pullout by May of this year.
Mr Biden pushed the date back by only a few months and the withdrawal was on track to finish by the end of August.
So far, Mr Biden has appeared resolute in his decision to quit Afghanistan, even as political blowback grows and reports of potential Taliban war crimes proliferate.
An additional 3,000 US troops are due to arrive in Kabul at the weekend but the Pentagon and State Department have stressed they are only there temporarily to help extract stranded US diplomats, personnel and some of the tens of thousands of Afghans who worked with America over the years and now face Taliban reprisals.