Follow the latest updates on Afghanistan here
A US intelligence assessment two months ago gave a warning that without continuing coalition support the Afghan Army would collapse completely with the loss of Kabul “within six months”.
That timeframe came down to weeks in the end, even with limited US air support in some of the final battles in the south and west of the country.
In the days before the fall of Kabul on August 15, the US government asserted that the Afghans had an Army of 350,000 men with an air force, more than capable of holding back the Taliban, who had neither tanks nor planes and were estimated to number no more than 75,000.
But the Special Inspector General for Afghanistan Reconstruction (Sigar) was more pessimistic in the watchdog’s final quarterly report on US security assistance, released last month.
“But from public reporting, the ANDSF appeared surprised and unready, and is now on its back foot.”
“It's important for them to change their behaviour, but they can do it,” said Inspector General John Sopko. “We have given them the hardware. We are funding them.”
So how did the Nato-trained Afghan Army collapse so quickly?
Quantity over quality
In the early years after the international intervention in 2001, the US believed that based on the size of the Taliban insurgency – then thought to number around 30,000 men – the Afghan National Army should be cut from 70,000 to 50,000.
The argument was that Afghanistan needed an army it could afford and one where quality could be sustained.
But within a year, the insurgency rapidly expanded in size, particularly in the south and east of the country, where coalition forces faced almost siege-like conditions in remote outposts, towns and cities whose names would become synonymous with heavy fighting: Laskhar Gah, Sangin and Kandahar, and the myriad small villages in between.
A surge in Taliban attacks led planners to reverse their decision to cut force numbers.
The subsequent expansion of the Army led to a struggle to maintain quality over quantity, an issue that the coalition could not resolve, as a 2010 Sigar report warned.
“Despite billions of dollars of international investment, army combat readiness has been undermined by weak recruitment and retention policies, inadequate logistics, insufficient training and equipment and inconsistent leadership,” the report said.
By 2014, recruits were being given 15 weeks of basic training – an improvement on the initial 10 week course, from a starting point where the force suffered illiteracy rates higher than 80 per cent.
That meant much of the course was reading and writing that might enable soldiers to read maps and send messages across Afghanistan's vast, rugged terrain, rather than developing combat skills.
“International support for the ANA must therefore be targeted not just toward increasing the quantity of troops but enhancing the quality of the fighting force," Sigar warned.
The Sigar report warned that the fundamental strategy whereby Afghans would take control of security to enable a coalition drawdown of forces was threatened by, “the US emphasis on rapid expansion of the army, in response to the growing insurgent threat”.
Between 2010 and 2020, the Afghan army would jump in strength from 113,000 to 185,000, although payroll corruption made it difficult to assess deployable strength.
The Afghan Army, Sigar warned, was becoming bloated and “unwieldy” – bigger than Afghan generals could manage effectively.
There were worse problems ahead. Sigar reporting over the decades warned consistently that corruption was deeply rooted, gradually eroding the morale of Afghan soldiers willing to fight, and sapping their combat capability as resources were siphoned off by corrupt commanders tied to political factions.
Virtually anything that could be stolen, from fuel to food and soldier’s wages, was up for the taking.
Meanwhile, political factionalism and ethnic divisions were left largely unresolved despite efforts to create ethnically mixed units.
The politicisation of the military left unqualified political loyalists in key security roles, including the micromanaging National Security Adviser Hamdullah Mohib, who had no military experience and was in charge during the final collapse of security.
A corrupt system where contractors supplied Afghan Army units with food “makes it difficult for troops to withstand long periods of isolation,” warned a 2016 United States Institute for Peace report.
“This system also applies to ammunition and fuel ... Fuel for operational support is widely wasted because of corruption or significantly delayed, rendering combat vehicles inoperable for a time.”
The Afghan Army’s human and material resources were eaten away by graft, sometimes literally in the form of payroll corruption where “ghost soldiers” plagued the force – non-existent recruits whose salaries were pocketed by commanders.
In a decade, almost no progress had been made: July’s final Sigar report on security noted that, after the implementation of a new electronic record-keeping system, the number of Afghan security forces shrank by 58,000 – the fighters did not exist.
The problem was so persistent that in the months leading up to the fall of southern urban centres Lashkar Gah and Kandahar, soldiers and police had gone months without pay.
“Afghan men in the Army and other forces don't want to die for those corrupt few in Kabul who only see Afghanistan as a money-making opportunity,” says Faran Jeffery, an analyst who has been closely tracking the conflict.
“They have demonstrated that beyond any doubt in past few weeks. For many, their only motivation was supposed to be their salary – and even that wasn't paid on time to many of them."
As coalition efforts drew down to Special Forces assistance missions and finally, remote air power support, the Afghan forces grew accustomed to the idea that in the worst case scenario, Washington would still be there with major firepower.
When that did not materialise, it was the final straw for many unpaid recruits.
“Once they figured out that US was definitely going to withdraw, their remaining motivation to fight also died,” Mr Jeffery says, referring to Mr Biden’s announcement in April that the US would withdraw forces and air support regardless of changing conditions on the ground.
But there is another side to the sudden change in territorial control, a shadowy political war fought by local Taliban commanders and tribal elders.
“I would say that a significant part of the government apparatus and the military, including pro-government militias, were open to changing sides. When a certain side seems to gain momentum, it attracts combatants and even leaders from other sides simply because there's usually no strong ideological commitment, only the will to survive and a need to secure wealth and careers,” says Afghanistan expert Lukas Muller, author of Wings over the Hindu Kush.
“We could see this again and again and I'd call it the Afghan war 'tradition'."
Mr Jeffery agrees.
“The Taliban's backdoor diplomacy, where they were in contact with several military leaders and telling them that they won't have anywhere to go after the Americans go so you better join the Taliban, that also played a major role,” he says.
“This is why we saw the Taliban taking large areas, including cities, without firing a bullet. It's because they already had an understanding with some military and political leaders as well as tribal leaders and local Islamic clerics and scholars.
“While the Afghan government’s nationalists were busy running hashtags on Twitter, Taliban Islamists were quietly doing homework on the ground. It's this homework that massively paid off in the end in a way that has even surprised senior Taliban leaders.”