Boris Johnson has said Nato’s “core mission” in Afghanistan has “succeeded”, with the country being largely cleared of al-Qaeda terrorists.
The prime minister said allied forces had also ensured better education, women’s rights and free elections.
But Labour leader Sir Keir Starmer accused him of “staggering complacency” and “betraying” the Afghan people.
The Taliban have taken control of Afghanistan after US President Joe Biden’s decision to withdraw troops.
Speaking during an emergency House of Commons debate on the situation, former Prime Minister Theresa May said the UK government seemed to have decided to go along with Washington’s decision “on a wing and a prayer”, in the hope that things would “turn out all right on the night”.
And one Conservative MP, a former soldier, called Mr Biden’s questioning of the Afghan army’s determination to fight the Taliban “shameful”.
Efforts are continuing to evacuate UK and other foreign citizens from Afghanistan, as the Taliban continue to strengthen their grip, with many people stranded at Kabul airport.
The UK has agreed to take in up to 20,000 refugees over the next few years, including 5,000 this year.
- Follow live: MPs debate Afghanistan
- UK to welcome 20,000 Afghans amid Taliban takeover
- What has the government done for Afghan asylum seekers?
- Ex-marine: I’m not leaving Kabul without my staff
The UK’s Parliament has been recalled from its summer break for the Afghanistan debate, but no vote is expected.
Addressing a packed Commons, Mr Johnson said: “It would be fair to say that the events in Afghanistan have unfolded and the collapse has been faster than even the Taliban themselves predicated.
“What is not true is to say the UK government was unprepared or did not foresee this.”
The prime minister promised to work to get UK nationals stuck in Afghanistan home “as soon as possible”, adding that the Taliban were currently “allowing that evacuation to go ahead”.
Amid frequent interventions from MPs, Mr Johnson said Nato forces had “succeeded in our core mission” of ridding Afghanistan of al-Qaeda operatives.
Mr Johnson said the Taliban – who have promised to observe human rights – must be judged on “actions rather than words”.
“At this bleak turning point we must help the people of Afghanistan determine the best of all possible futures,” he added.
But opposition leader Sir Keir Starmer accused the prime minister of “staggering complacency” and “appalling” judgement by failing to plan properly for the withdrawal of troops over the past 18 months.
“What we have won over the past 20 years could all be lost – that is the cost of careless leadership,” he said.
To jeers from Conservative MPs, he said: “The prime minister’s response to the Taliban arriving at the gates of Kabul was to go on holiday.”
Sir Keir said the government’s refugee repatriation target was too small and the 20,000 figure had been “plucked out of the air”.
He argued that the “sacrifice” made by UK troops in Afghanistan since the 2001 invasion – which ousted the previous Taliban regime following the 11 September terror attacks on the US – had not been “in vain”.
But he warned: “The gains through 20 years of sacrifice hang precariously.”
The SNP’s Westminster leader, Ian Blackford, argued that the future of Afghanistan had “never been so uncertain” and that it was “our moral and ethical responsibility” to help more refugees.
Conservative MP Tom Tugendhat, who chairs the Commons Defence Committee and himself served in Afghanistan, criticised Mr Biden for questioning the willingness of the Afghan army to fight the Taliban.
Amid silence in the Commons chamber, he said: “To see [the US] commander-in-chief call into question the courage of the 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.”
The House of Commons debate on Afghanistan is expected to last until about 17:00 BST, with the House of Lords also sitting to discuss the situation.
A group of former Afghan translators for the British Army held a demonstration on Parliament Square, urging greater protection for their ex-colleagues and relatives,
“The Taliban will butcher every single one of them if they are left behind,” one of them said.
Another protest, by the Stop the War group, also took place, involving former Labour leader Jeremy Corbyn.
On Tuesday night an RAF plane carrying UK nationals and Afghans landed at RAF Brize Norton in Oxfordshire.
The Taliban have been advancing across Afghanistan over the past few months, but their progress accelerated after Mr Biden announced the withdrawal of his country’s troops.
By BBC NEWS