Celebratory gunfire echoed across Kabul as Taliban fighters took control of the airport before dawn on Tuesday following the withdrawal of the last US troops, ending 20 years of war that left the Islamic militia stronger than it was in 2001.
Shaky video footage distributed by the Taliban showed fighters entering the airport after the last US troops took off a minute before midnight, marking the end of a hasty and humiliating exit for Washington and its NATO allies.
"The last US soldier has left Kabul airport and our country gained complete independence," Taliban spokesman Qari Yusuf said, according to Al Jazeera TV.
The US Army shared an image taken with night-vision optics of the last US soldier to step aboard the final evacuation flight out of Kabul - Major General Chris Donahue, commander of the 82nd Airborne Division.
America's longest war took the lives of nearly 2,500 US troops and an estimated 240,000 Afghans, and cost some $2 trillion.
Although it succeeded in driving the Taliban from power and stopped Afghanistan being used as a base by al Qaeda to attack the United States, it ended with the hardline Islamic militants controlling more of the country than they ever did during their previous rule from 1996 to 2001.
Those years were marked by the brutal enforcement of the Taliban's strict interpretation of Islamic law, and the world is now watching to see whether it forms a more moderate and inclusive government in the months ahead.
A massive but chaotic airlift by the United States and its allies over the past two weeks succeeded in evacuating more than 122,000 people from Kabul, but still left behind tens of thousands of Afghans who helped Western countries and fear reprisals by the Taliban.
A contingent of Americans, estimated by US Secretary of State Antony Blinken as under 200 and possibly closer to 100, wanted to leave but were unable to get on the last flights.
General Frank McKenzie, commander of the US Central Command, told a Pentagon briefing that the chief US diplomat in Afghanistan, Ross Wilson, was on the last C-17 flight out.
"There's a lot of heartbreak associated with this departure. We did not get everybody out that we wanted to get out. But I think if we'd stayed another 10 days, we wouldn't have gotten everybody out," McKenzie told reporters.
President Joe Biden, in a statement, defended his decision to stick to a Tuesday deadline for withdrawing US forces. He said the world would hold the Taliban to their commitment to allow safe passage for those who want to leave Afghanistan.
"Now, our 20-year military presence in Afghanistan has ended," said Biden, who thanked the US military for carrying out the dangerous evacuation. He plans to address the American people on Tuesday afternoon.
Biden has said the United States long ago achieved the objectives it set in ousting the Taliban in 2001 for harboring al Qaeda militants who masterminded the Sept. 11 attacks on the United States.
The president has drawn heavy criticism from Republicans and some of his fellow Democrats for his handling of Afghanistan since the Taliban took over Kabul earlier this month after a lightning advance and the collapse of the US-backed government.
Senator Ben Sasse, a Republican member of the Senate Intelligence Committee, called the US withdrawal a "national disgrace" that was "the direct result of President Biden's cowardice and incompetence."
But Democratic Senator Sheldon Whitehouse tweeted: "Bravo to our diplomats, military, and intelligence agencies. An airlift of 120,000 people in that dangerous and tumultuous situation is something no one else could do."
Blinken said the United States was prepared to work with the new Taliban government if it does not carry out reprisals against opponents in the country.
"The Taliban seeks international legitimacy and support. Our position is any legitimacy and support will have to be earned," he said.
The Taliban must revive a war-shattered economy without being able to count on the billions of dollars in foreign aid that flowed to the previous ruling elite and fed systemic corruption.
The population outside the cities is facing what UN officials have called a catastrophic humanitarian situation worsened by a severe drought.