FACING sharp criticism over the tumultuous U.S. withdrawal from Afghanistan, President Joe Biden said on Tuesday it was the best available option to end both the United States' longest war and decades of fruitless efforts to remake other countries through military force.

Biden portrayed the chaotic exit as a logistical success that would have been just as messy even if it had been launched weeks earlier, while staying in the country would have required committing more American troops.

"I was not going to extend this forever war," he said in a speech from the White House.

Earlier in the day, the Taliban, which seized control of Afghanistan in a lightning advance this month, fired guns into the air and paraded coffins draped in U.S. and NATO flags as they celebrated their victory.

In his first remarks since the final pullout of U.S. forces on Monday, Biden said 5,500 Americans had been evacuated and that the United States had leverage over the Islamist militant group to ensure 100 to 200 others could also depart if they wanted to.

He said Washington would continue to target militants who posed a threat to the United States, but would no longer use its military to try to build democratic societies in places that had never had them.

"This decision about Afghanistan is not just about Afghanistan. It's about ending an era of major military operations to remake other countries," he said.

The Taliban now control more territory than when they last ruled before being ousted in 2001 at the start of America's longest war, which took the lives of nearly 2,500 U.S. troops and an estimated 240,000 Afghans, and cost some $2 trillion.

More than 123,000 people were evacuated from Kabul in a massive but chaotic airlift by the United States and its allies over the past two weeks, but many of those who helped Western nations during the war were left behind.

Biden said the only other option would have been to step up the fight and continue a war that "should have ended long ago." Starting the withdrawal in June or July, as some have suggested, would only have hastened the Taliban's victory, he said.

But Biden's decision was far from popular and he has faced criticism from Republicans and fellow Democrats, as well as from foreign allies.

U.S. Senate Republican leader Mitch McConnell said the departure had abandoned Americans behind enemy lines.

"We are less safe as a result of this self-inflicted wound," he said in his home state of Kentucky.

ELATION AND FEAR

The U.S. invasion in 2001, which followed the Sept. 11 attacks on New York and Washington, stopped Afghanistan from being used by al Qaeda as a base to attack the United States and ended a period of Taliban rule from 1996 in which women were oppressed and opponents crushed.

There was a mixture of triumph, elation and fear on the streets of Afghanistan as the Taliban celebrated their victory.

"We are proud of these moments, that we liberated our country from a great power," Taliban spokesman Zabihullah Mujahid said.

While crowds lined the streets of the eastern city of Khost for a mock funeral with coffins draped with Western flags, long lines formed in Kabul outside banks closed since the fall of the capital.

"I had to go to the bank with my mother but when I went, the Taliban (were) beating women with sticks,” said a 22-year-old woman who spoke on condition of anonymity because she feared for her safety.

"It’s the first time I’ve seen something like that and it really frightened me."

The Taliban's previous government brutally enforced a radical interpretation of Islamic law but Biden has said the world would hold them to their recent commitments to uphold human rights and allow safe passage for those wanting to leave Afghanistan.

Western donors have said future aid to the war and drought-ravaged country will be contingent on those promises being met.

European Union countries proposed to step up assistance to Afghanistan and its neighbours, amid fears that up to half a million Afghans could flee their homeland by the end of the year.

The United States last week issued a license authorizing it and its partners to continue to facilitate humanitarian aid in Afghanistan even though the Taliban is blacklisted by Washington, a Treasury Department official told Reuters.

The license authorizes the U.S. government and its contractors to support humanitarian assistance to people in Afghanistan, including the delivery of food and medicine, despite U.S. sanctions on the Taliban.

Pentagon spokesman John Kirby said the United States was concerned about the potential for Taliban retribution and mindful of the threat posed by ISIS-K, the Islamic State affiliate that claimed responsibility for a suicide bombing outside Kabul airport on Thursday that killed 13 U.S. service members and scores of Afghan civilians.

At least seven Taliban fighters were killed in clashes with anti-Taliban rebels in the Panjshir valley north of the capital on Monday night, two members of the opposition group said.