The U.S. military has completed its withdrawal from Afghanistan to end a brutal 20-year war -- one that started and ended with the hardline Islamist Taliban in power, despite billions of dollars spent trying to rebuild the conflict-wracked country.
Celebratory gunfire rang out in Kabul in the early hours of Tuesday, and elated senior Taliban officials hailed the event as a watershed moment.
The withdrawal came after the fraught final days of a frantic mission to evacuate tens of thousands of Americans and Afghans who had helped the US-led war effort -- and which left scores of Afghans and 13 U.S. troops dead in a suicide attack last week.
That attack -- claimed by the Islamic State's Afghan offshoot -- gave edgy urgency to the risky U.S.-led international airlift from Kabul, and also revealed the possible troubles ahead for Afghanistan as the Taliban move to form a government and actually rule.
The withdrawal came before the end of August 31, the actual deadline set by President Joe Biden to call time on America's longest war -- one that ultimately claimed the lives of more than 2,400 US servicemembers.
"I'm here to announce the completion of our withdrawal from Afghanistan and the end of the military mission to evacuate American citizens," US General Kenneth McKenzie told reporters Monday Washington time.
"Tonight's withdrawal signifies both the end of the military component of the evacuation but also the end of the nearly 20-year mission that began in Afghanistan shortly after September 11th, 2001."
The final flight left at 1929 GMT Monday - just before the start of Tuesday in Kabul, he said.
Biden said he would address the nation on Tuesday in Washington.
Taliban spokesman Zabihullah Mujahid said Afghanistan had "gained full independence" with the US withdrawal, and Anas Haqqani, a senior Taliban official, said he was "proud" to witness "these historic moments".
AFP correspondents in the city heard celebratory gunfire from several Taliban checkpoints, as well as the cheers of fighters manning security posts in the green zone.
- Exodus cut short -
The return to power a fortnight ago of the Taliban movement, which was toppled in 2001 when the United States invaded in retaliation for the carnage on 9/11, triggered a massive exodus of people who fear a new version of hardline Islamist rule.
The evacuation flights have taken more than 123,000 people out of Kabul airport, according to McKenzie, but he admitted not everyone who wanted to leave was able to, and that the "diplomatic mission" to allow others to leave will continue.
How that process will unfold is unclear.
The UN Security Council adopted a resolution Monday, requiring the Taliban to honor a commitment to let people freely leave Afghanistan in the days ahead, and to grant access to the UN and other aid agencies, but did not create a "safe zone" in Kabul.
But talks are ongoing as to who will now run Kabul airport. The Taliban have asked Turkey to handle logistics while they maintain control of security, but President Recep Tayyip Erdogan has not yet accepted that offer.
And it was not immediately clear which airlines would agree to fly in and out of Kabul.
The regional Islamic State-Khorasan (IS-K) group, rivals of the Taliban, posed the biggest threat to the withdrawal when it carried out a devastating suicide bombing outside the airport last week.
On Monday, they claimed to have fired six rockets at the airport. A Taliban official said the attack was intercepted by the airport's missile defence systems.
An AFP photographer saw a destroyed car with a launcher system still visible in the back seat.
- 'Potential loss of innocent life' -
The United States said Sunday it had carried out a drone strike against a vehicle threatening the Kabul airport that had been linked to the regional Islamic State chapter -- its second targeting IS-K in recent days.
But on Monday, it looked like they had possibly made a terrible mistake.
Members of one family told AFP they believed a fatal error had been made, and that 10 civilians were killed.
"My brother and his four children were killed. I lost my small daughter.. nephews and nieces," Aimal Ahmadi told AFP.
A spokesman for US Central Command said Sunday that the US was "aware of reports of civilian casualties" and was investigating.
"We would be deeply saddened by any potential loss of innocent life," he said.
In recent years, the Islamic State's Afghanistan-Pakistan chapter has been responsible for some of the deadliest attacks in those countries.
While both the Islamic State and the Taliban are hardline Sunni Islamists, they are at times also bitter foes -- with each claiming to be the true flag-bearers of jihad.
- End of an era -
The US military effort in Afghanistan was winding down without incident ahead of the August 31 deadline when Biden was forced to send 6,000 troops back into Kabul just two weeks ago to secure evacuations as the Taliban steamrolled across the country.
The victory of the hardliners and the decision by ousted Afghan president Ashraf Ghani to flee the country sparked panic in Kabul, where thousands of Afghans flocked to the airport in the hopes of leaving the Taliban-ruled country.
A few even clung to a US military aircraft taking off in a desperate bid to flee -- only to fall from the sky.
All told, the US military spent more than $775 billion on operations in Afghanistan since 2001, according to the latest available data from September 2019.
But a study conducted at Brown University suggests the total could be far higher, perhaps topping $2.3 trillion.