US President Joe Biden has admitted there was no way for troops to pull out from Afghanistan “without chaos ensuing”.

The withdrawal of US troops was agreed under Mr Biden’s predecessor Donald Trump in last year’s controversial “peace deal” with the Taliban, but it was implemented under Mr Biden’s presidency and was expected to be complete by the end of this month.

The withdrawal allowed the Taliban to advance rapidly through the country, taking all major cities – including the capital Kabul – by mid-August.

Mr Biden told ABC News that there was nothing his administration could have done to avoid the resulting chaos, as thousands of Afghans try desperately to escape the incoming regime.

“The idea that, somehow, there’s a way to have gotten out without chaos ensuing, I don’t know how that happens,” Mr Biden said.

There are up to 15,000 Americans in Afghanistan and up to 65,000 Afghans and their families the US also wants to rescue.

Some 4,500 US troops are maintaining security at the airport in Kabul until the evacuation is complete but US Defence Secretary Lloyd Austin III had said the US is “not close to where we want to be” in terms of the process.

More on Afghanistan

Mr Biden said the US would do “everything in our power” to get its citizens out before the end-of-month deadline, adding: “we’re gonna stay until we get them all out”.

Many of the Afghans will have worked as interpreters for US troops during the 20-year conflict and will be especially fearful of a vengeful Taliban.

Footage was shown earlier this week of people so desperate to escape the country that they were clinging to a plane’s landing gear as it tried to leave from Kabul’s international airport.

After it took off, a few of them were seen falling from the plane and towards the ground.

When asked about the pictures, Mr Biden was dismissive, saying: “That was four days ago, five days ago.”

He added: “What I thought (when I saw the pictures) was we have to gain control of this, we have to move this more quickly, we have to move in a way in which was can take control of that airport. And we did.”

Mr Biden also repeated his criticism of Afghanistan’s security forces, blaming them for the country’s collapse in the face of the Taliban advance.

Earlier in the week, he had said: “American troops cannot and should not be fighting the war, and dying in a war that Afghan forces are not willing to fight for themselves.”

Please use Chrome browser for a more accessible video player

Conservative MP Tom Tugendhat speaks about Afghanistan

The claim had prompted angry responses from many of those in the US and UK who worked alongside local security forces.

One of them was British MP Tom Tugendhat, who served as an Army officer in Afghanistan and told the House of Commons on Wednesday: “To see (Biden) call into question the courage of men I fought with, to claim that they ran, is shameful.

“Those who have never fought for the colours they fly should be careful about criticising those who have.”

But in his ABC interview, Mr Biden said: “When you had the government of Afghanistan, the leader of that government, get in a plane and taking off and going to another country, when you saw the significant collapse of the Afghan troops we had trained – up to 300,000 of them – just leaving their equipment and and and taking off.

“That was… that’s what happened. That’s simply what happened.”

But data from Harvard University’s Kennedy School and from the Brown University Costs of War project shows the high price paid by Afghanistan’s security forces.

While the project recorded 2,448 US military deaths and 3,846 US contractor deaths in Afghanistan up to April, some 66,000 Afghan military and police were killed, along with more than 47,000 Afghan civilians.