ITV News Politics Correspondent Carl Dinnen reports on the debate
The prime minister opened a debate on the situation in Afghanistan after recalling Parliament at late notice amid the Islamist group's recapture of the country, 20 years after it was ousted by Western forces during the doomed 'war on terror'.
Both the UK and US government have been heavily attacked for the way forces remaining in the country were withdrawn, with critics questioning why leaders did not predict the Taliban's swift insurgence.
But the prime minister defended the UK, saying it is "not true is to say that the UK government was unprepared or did not foresee this, because it was certainly part of our planning".
He appeared to blame America's unilateral withdrawal from Afghanistan for events in the country, saying the "West could not continue this US-led mission... without American logistics, without US air power and without American might".
He added: "I really think it is an illusion to believe that there is appetite amongst any of our partners for a continue military presence or for a military solution imposed by NATO in Afghanistan."
Former prime minister Theresa May attacked her successor, asking "was our intelligence really so bad" that both he and President Joe Biden claimed the Taliban would be incapable of overthrowing the former Afghan government.
She told MPs: "What has been most shocking has been the chaos and speed of the takeover by the Taliban.
"In July this year both President Biden and the Prime Minister indicated that they did not think the Taliban was ready or able to take over control of the country.
"Was our intelligence really so poor? Was our understanding of the Afghan government so weak? Was our knowledge of the position on the ground so inadequate? Or did we really believe this? Or did we feel we just had to follow the United States and hope that on a wing and a prayer it'd be all right on the night?
"Because the reality is that as long as this time limit was given and dates given for withdrawal, all the Taliban had to do was to ensure there were sufficient problems for the Afghan government not to be able to have full control of the country and then just sit and wait."
Prime Minister Johnson said a plan to remove British nationals from Afghanistan had been in place for two weeks, long before the Taliban captured Kabul airport.
But he said the focus must now be on helping Afghan refugees to leave the country and preventing a humanitarian crisis within the country, while also protecting the human rights of those unable to leave.
Mr Johnson's spokesman told journalists that aid funding for the country would double to £286 million but said: "We are not giving this money to the Taliban."
He said it would be distributed in conjunction with the UN and other NGOs (non-governmental organisations).
Watch the MPs debate on the Afghanistan crisis in full
The PM said: "I can tell the House that we have so far... secured the safe return of 306 UK nationals and 2,052 Afghan nationals as part of our resettlement programme, with a further 2,000 Afghan applications completed and many more being processed.
"UK officials are working round the clock to keep the exit door open in the most difficult circumstances and actively seeking those we believe are eligible but as yet unregistered."
Downing Street said the British embassy in Afghanistan "effectively has relocated to the airport" in Kabul.
No 10 said the Foreign Office's rapid deployment team had now arrived in the country and was "working on the ground, alongside the ambassador and others".
MR Johnson's spokesman said the former embassy building was "not occupied currently" and that the Taliban was allowing the UK to proceed with its evacuation.
The prime minister suggested the new government in Afghanistan could avoid being made a pariah by democratic countries around the world, if it protects human rights.
He said: "We will judge this regime based on the choices it makes – and by its actions rather than by its words.
"On its attitude to terrorism, to crime and narcotics, as well as humanitarian access and the rights of girls to receive an education. Defending human rights will remain of the highest priority.
"And we will use every available political and diplomatic means to ensure that those human rights remain at the top of the international agenda."
Downing Street, however, would not be drawn on whether the UK would recognise any government formed by the Taliban in Afghanistan.
It said any decision would need a "unified approach" internationally.
Mr May said events in Afghanistan presented "a major setback for British foreign policy" nearly 20 years after UK forces first entered the country in the wake of the 9/11 terror attacks on the US.
In an emotional speech which drew rare applause from some MPs, Tory Tom Tugendhat - who served as an Army officer in Afghanistan - said the UK and its Western allies had received a "very harsh lesson".
"This doesn't need to be defeat but at the moment it damn well feels like it," he said.
Mr Johnson ended his Commons address by insisting British soldiers who lost their lives in Afghanistan did not die in vain, and those who fought there should be "proud of their achievements".
He added: "Because no matter how grim the lessons of the past that future is not yet written and at this bleak turning-point we must help the people of Afghanistan to choose the best of all their possible futures."
But Labour leader Sir Keir said the recent events in Afghanistan had brought "shame [on] the West".
"It's been a disastrous week, an unfolding tragedy" in Afghanistan, Sir Keir said, adding: "The desperate situation requires leadership and for the prime minister to snap out of his complacency."
On Tuesday night, Mr Johnson announced a new settlement scheme, which would allow up to 20,000 Afghan vulnerable refugees to seek sanctuary in the UK over the coming years.
But Sir Keir called on the prime minister to create an Afghan refugee resettlement programme that "meets the scale of the challenge".
The Labour leader told the Commons: "The scale of the refugee crisis requires an international response but we must lead it, and lead with a resettlement programme that meets the scale of the challenge.
"The scheme must be generous and welcoming.
"If it is not, we know the consequences, we know the consequences now: violent reprisals in Afghanistan, people tragically fleeing into the arms of human traffickers - we know this is what will happen - more people risking and losing their lives on unsafe journeys including across the English Channel.
"We cannot betray our friends, we must lead."
The new Afghan Citizens’ Resettlement Scheme will target women, children, and others who have been forced to flee their home or face threats of persecution from the Taliban.
Sir Keir Starmer attacked the scheme as "vague" and said numbers in it had been "plucked out of the air".
"We do not turn our backs on friends at their time of need - we owe an obligation to the people of Afghanistan," the Labour leader added.
It comes three days after the Taliban's rapid advance culminated in the capture of Afghanistan’s capital Kabul.
The first flight of British nationals and embassy staff arrived on Sunday night at Brize Norton, a Royal Air Force airbase in Oxfordshire, around 75 miles (120 kilometers) northwest of London.
Labour leader Sir Keir praised the British ambassador to the country for assisting in processing applications of those desperate to leave Afghanistan, but he attacked the prime minister and foreign secretary for what he suggested was inaction on their part.
"The prime minister's response to the Taliban arriving at the gates of Kabul was to go on holiday.
"No sense of the gravity of the situation, not leadership to drive international efforts on the evacuation."
When asked by the Tory benches what he would do differently, Sir Keir said: "I wouldn't stay on holiday whilst Kabul was falling."
Addressing Foreign Secretary Dominic Raab, Sir Keir said: "He shouts now but he stayed on holiday while our mission in Afghanistan was disintegrating. He didn't even speak to ambassadors in the region as Kabul fell to the Taliban. Let that sink in.
"You cannot co-ordinate an international response from the beach. A dereliction of duty by the Prime Minister and the Foreign Secretary, a Government totally unprepared for the scenario that it had 18 months to prepare for."
He said the British and Afghan people will "have to live with the consequences of the Prime Minister's failure", adding: "What we've won through 20 years of sacrifice could all be lost.
"That is the cost of careless leadership."
Mr Raab furiously hit back, saying the Labour leader has no "credible" alternatives to the government's approach.
"The right honourable gentleman did not give a single example of an action he would have taken that we have not - not one.
"But then issued a series of searing criticisms. The shadow foreign secretary took a similar approach in her speech."
Mr Raab said: "The leader of the Labour Party agreed the decision to withdraw, but now, with his predictable proclivity for hindsight, the right honourable gentleman criticises the consequences of a decision that he backed.
"He does so with no serious or credible alternative of his own, not even a hint, a reminder of Shakespeare's adage, the empty vessel makes the greatest sound."