Washington: After 13 years, the United States is winding down its war in Afghanistan, plagued by doubts about what was accomplished at such a high cost.

Instead of a sense of triumph at the close of the longest conflict in America's history, there is mostly regret and fatigue over a war that claimed the lives of more than 2,300 American troops and cost more than a trillion dollars.

US commanders insist the Afghan security forces will hold the line in a stalemate with the Taliban. But some officials fear a repeat of Iraq, in which an American-trained army virtually collapsed in the face of a jihadist onslaught.

A large majority of Americans now say the war was not worth it, and only 23 per cent of US soldiers believe the mission has been a success, according to recent polls.

But when it began, the war enjoyed overwhelming support and victory seemed within reach.

Less than a month after al Qaeda's attacks of September 11, 2001, president George W Bush captured the nation's sense of righteous anger as he announced military action in Afghanistan in a televised address in October.

The goal was to "disrupt the use of Afghanistan as a terrorist base of operations," Bush said, and to attack the Taliban regime that had hosted al Qaeda and refused to hand over its leaders.

US objectives were met with stunning speed. Al Qaeda training camps were wiped out and Northern Alliance fighters -- backed by US-led air strikes and a small number of American special forces -- toppled the Taliban regime within a month.

For the United States, the war seemed all but over.

But the Taliban eventually regrouped from safe havens in neighboring Pakistan, even as Washington's attention shifted to a new war in Iraq.

The Taliban grew into a virulent insurgency that exploited resentment of a corrupt, ineffective government in Kabul.

The United States formed the backbone of an international force that found itself in a protracted fight with insurgents.

The US-led contingent steadily expanded -- while the goals of the war became increasingly ambitious as well.

Washington and its allies embraced the lofty ideals of nation-building, vowing to fight corruption, foster economic development, and forge a "stable, democratic state" in an impoverished land mired in war for decades.

The results were often disappointing. International aid helped build roads and schools, but it also was blamed for fueling rampant corruption, with some of the money ending up with the insurgents.