WASHINGTON -- Built and trained at a two-decade cost of US$83 billion, Afghan security forces collapsed so quickly and completely -- in some cases without a shot fired -- that the ultimate beneficiary of the American investment turned out to be the Taliban. They grabbed not only political power but also U.S.-supplied firepower -- guns, ammunition, helicopters and more.

The Taliban captured an array of modern military equipment when they overran Afghan forces who failed to defend district centers. Bigger gains followed, including combat aircraft, when the Taliban rolled up provincial capitals and military bases with stunning speed, topped by capturing the biggest prize, Kabul, over the weekend.

A U.S. defense official on Monday confirmed the Taliban's sudden accumulation of U.S.-supplied Afghan equipment is enormous. The official was not authorized to discuss the matter publicly and so spoke on condition of anonymity. The reversal is an embarrassing consequence of misjudging the viability of Afghan government forces -- by the U.S. military as well as intelligence agencies -- which in some cases chose to surrender their vehicles and weapons rather than fight.

The U.S. failure to produce a sustainable Afghan army and police force, and the reasons for their collapse, will be studied for years by military analysts. The basic dimensions, however, are clear and are not unlike what happened in Iraq. The forces turned out to be hollow, equipped with superior arms but largely missing the crucial ingredient of combat motivation.

"Money can't buy will. You cannot purchase leadership," John Kirby, chief spokesman for Defense Secretary Lloyd Austin, said Monday.

Doug Lute, a retired Army lieutenant general who help direct Afghan war strategy during the George W. Bush and Barack Obama administrations, said that what the Afghans received in tangible resources they lacked in the more important intangibles.

"The principle of war stands -- moral factors dominate material factors," he said. "Morale, discipline, leadership, unit cohesion are more decisive than numbers of forces and equipment. As outsiders in Afghanistan, we can provide materiel, but only Afghans can provide the intangible moral factors."

By contrast, Afghanistan's Taliban insurgents, with smaller numbers, less sophisticated weaponry and no air power, proved a superior force. U.S. intelligence agencies largely underestimated the scope of that superiority, and even after President Joe Biden announced in April he was withdrawing all U.S. troops, the intelligence agencies did not foresee a Taliban final offensive that would succeed so spectacularly.

"If we wouldn't have used hope as a course of action, ... we would have realized the rapid drawdown of U.S. forces sent a signal to the Afghan national forces that they were being abandoned," said Chris Miller, who saw combat in Afghanistan in 2001 and was acting secretary of defense at the end of President Donald Trump's term.

Stephen Biddle, a professor of international and public affairs at Columbia University and a former adviser to U.S. commanders in Afghanistan, said Biden's announcement set the final collapse in motion.

"The problem of the U.S. withdrawal is that it sent a nationwide signal that the jig is up -- a sudden, nationwide signal that everyone read the same way," Biddle said. Before April, the Afghan government troops were slowly but steadily losing the war, he said. When they learned that their American partners were going home, an impulse to give up without a fight "spread like wildfire."

The failures, however, go back much further and run much deeper. The United States tried to develop a credible Afghan defense establishment on the fly, even as it was fighting the Taliban, attempting to widen the political foundations of the government in Kabul and seeking to establish democracy in a country rife with corruption and cronyism.

Year after year, U.S. military leaders downplayed the problems and insisted success was coming. Others saw the handwriting on the wall. In 2015 a professor at the Army War College's Strategic Studies Institute wrote about the military's failure to learn lessons from past wars; he subtitled his book, "Why the Afghan National Security Forces Will Not Hold."

"Regarding the future of Afghanistan, in blunt terms, the United States has been down this road at the strategic level twice before, in Vietnam and Iraq, and there is no viable rationale for why the results will be any different in Afghanistan," Chris Mason wrote. He added, presciently: "Slow decay is inevitable, and state failure is a matter of time."

Some elements of the Afghan army did fight hard, including commandos whose heroic efforts are yet to be fully documented. But as a whole the security forces created by the United States and its NATO allies amounted to a "house of cards" whose collapse was driven as much by failures of U.S. civilian leaders as their military partners, according to Anthony Cordesman, a longtime Afghanistan war analyst at the Center for Strategic and International Studies.

The Afghan force-building exercise was so completely dependent on American largesse that the Pentagon even paid the Afghan troops' salaries. Too often that money, and untold amounts of fuel, were siphoned off by corrupt officers and government overseers who cooked the books, creating "ghost soldiers" to keep the misspent dollars coming.

Of the approximately $145 billion the U.S. government spent trying to rebuild Afghanistan, about $83 billion went to developing and sustaining its army and police forces, according to the Office of the Special Inspector General for Afghanistan Reconstruction, a congressionally created watchdog that has tracked the war since 2008. The $145 billion is in addition to $837 billion the United States spent fighting the war, which began with an invasion in October 2001.

The $83 billion invested in Afghan forces over 20 years is nearly double last year's budget for the entire U.S. Marine Corps and is slightly more than what Washington budgeted last year for food stamp assistance for about 40 million Americans.

In his book, "The Afghanistan Papers," journalist Craig Whitlock wrote that U.S. trainers tried to force Western ways on Afghan recruits and gave scant thought to whether U.S. taxpayers dollars were investing in a truly viable army.

"Given that the U.S. war strategy depended on the Afghan army's performance, however, the Pentagon paid surprisingly little attention to the question of whether Afghans were willing to die for their government," he wrote.

------

Associated Press writers Nomaan Merchant, Lorne Cook in Brussels and James LaPorta in Boca Raton, Florida, contributed to this report.