U.S. forces were in the final phase of pulling out of Kabul, ending two decades of costly involvement in Afghanistan, as the country's new Taliban rulers prepared to take control of the airport.

Just over 1,000 civilians remained at the airport on Sunday to be flown out before the troops finally leave, a Western security official told Reuters.

"We want to ensure that every foreign civilian and those who are at risk are evacuated today. Forces will start flying out once this process is over," said the official, who is stationed at the airport.

U.S. President Joe Biden has said he will stick by his deadline to withdraw all U.S. troops from Afghanistan by Tuesday. A U.S. official told Reuters on Saturday that fewer than 4,000 troops remained at the airport.

U.S. and allied forces have mounted a massive two-week effort to ferry foreign nationals and tens of thousands of vulnerable Afghans out of the country.

The airlift - one of the biggest such evacuation operations ever - marked the end of a 20-year Western mission in Afghanistan that began when U.S.-led forces ousted a Taliban government that had provided safe haven for the perpetrators of the Sept. 11, 2001 attacks on the United States.

The final chapter came quickly after the United States and the Taliban made a deal to end the foreign involvement. The Western-backed government and Afghan army melted away as Taliban fighters swept across the country and took control of Kabul on Aug. 15.

The United States and allies have taken about 114,400 people out of Afghanistan in the past two weeks, but tens of thousands who want to go will be left behind.

"We tried every option because our lives are in danger. They (the Americans or foreigners) must show us a way to be saved. We should leave Afghanistan or they should provide a safe place for us," said one woman outside the airport.

A Taliban official told Reuters the Islamist group had engineers and technicians ready to take charge of the airport.

"We are waiting for the final nod from the Americans to secure full control over Kabul airport as both sides aim for a swift handover," said the official, speaking on condition of anonymity.

Britain's last military flight left Kabul on Saturday night after a chaotic two weeks at the airport that was plunged into a bloodbath on Thursday when an Islamic State suicide bomb attack outside the airport gates killed at least 90 Afghans and 13 American troops.

Biden headed on Sunday to Dover Air Force Base to honour members of the U.S. military killed in the attack as their remains were returned to the United States.

A top U.S. official said the Biden administration expects the Taliban to continue allowing safe passage for Americans and others to leave Afghanistan after the U.S. military withdrawal is completed.

"The Taliban have both communicated privately and publicly that they will allow for safe passage," said Jake Sullivan, Biden's national security adviser, in a CBS TV interview set to be broadcast Sunday.

FINANCIAL AND HUMANITARIAN CRISIS

The collapse of the Afghan government leaves an administrative vacuum that has led to fears of an economic crisis and widespread hunger.

Prices for commodities like flour, oil and rice are rapidly rising and the currency is plunging, with money changers across the border in Pakistan already refusing to accept the afghani.

On Saturday, officials ordered banks to re-open and imposed a limit on withdrawals of $200 or 20,000 afghani. Long queues forming outside bank branches of people trying to get money out.

Taliban spokesman Zabihullah Mujahid has said the difficulties will subside quickly once the new administration is up and running.

But with its economy shattered by decades of war, Afghanistan is now facing the end of billions of dollars in foreign aid poured in by Western donors.

Mujahid said the Taliban would announce a full cabinet in the coming days. It had appointed governors and police chiefs in all but one of Afghanistan's 34 provinces, he said.

It also appealed to the United States and other Western nations to maintain diplomatic relations after withdrawing. Britain said that should happen only if the Taliban allow safe passage for those who want to leave and respect human rights.

The Taliban's 1996-2001 rule was marked by a harsh version of sharia, Islamic law, with many political rights and basic freedoms curtailed and women severely oppressed.

Afghanistan was also a hub for anti-Western militants, and Washington, London and others fear it might become so again.

CITY CALM

While Kabul's airport has been in chaos, the rest of the city has been generally calm. The Taliban have told residents to hand over government equipment including weapons and vehicles within a week.

The Western security official said crowds at the airport gates had diminished after a specific warning from the U.S. government of another attack by ISIS-K, the branch of Islamic State in Afghanistan that is an enemy of both the West and the Taliban.

The United States said on Saturday it had killed two ISIS-K militants. Biden had vowed to hunt down the perpetrators of the explosion and said the strike was not the last.

The Taliban condemned the U.S. drone strike, which took place in Nangarhar province, an eastern area that borders Pakistan.

The airport attack added fuel to criticism Biden faced at home and abroad for the chaos. He has defended his decisions, saying the United States long ago achieved its rationale for invading in 2001.

British Prime Minister Boris Johnson has faced accusations that his government had been "asleep on watch."

Johnson said Britain would not have wished to leave Afghanistan in such a manner. But Richard Dannatt, a former head of the British army, said the British government need to investigate why it was so ill-prepared for the rapid fall of Afghanistan to the Taliban.

"It is unfathomable why it would appear that the government was asleep on watch," Dannat told Times Radio.

(Reporting by Reuters bureaus and Rupam Jain Writing by Raju Gopalakrishnan and Angus MacSwan Editing by William Mallard and Frances Kerry)