Joe Biden vowed to plough ahead with the evacuation of those trying to flee Afghanistan and punish the perpetrators of an attack outside Kabul’s airport that killed at least 13 US troops and dozens of Afghans.

At the end of what one aide called “maybe the worst day” of his eight-month presidency, Biden attempted to appear both a sombre mourner-in-chief and a resolute leader steeling the nation for what could be a difficult final withdrawal from the Afghan capital, which he aims to complete by Tuesday.

“We will not be deterred by terrorists, we will not let them stop our mission. We will continue the evacuation,” Biden said in remarks at the White House on Thursday. “We will not forgive. We will not forget. We will hunt you down and make you pay.”

Despite Biden’s defence of his withdrawal decision, the deaths of the American forces was only the most recent catastrophe to beset his strategy, which has seen the Taliban seize Kabul, a hurried redeployment of thousands of US troops and mass flight from the country — all in less than two weeks.

Thursday was the deadliest day for the American military in Afghanistan in a decade and marked the first time US troops were killed in action there since February 2020.

Isis claimed responsibility for the suicide bombings near the airport. A gunman opened fire on civilians and troops following the blasts.

At least 60 Afghan civilians were killed and more than 140 were wounded, according to the Associated Press.

Zabihullah Mujahid, a spokesperson for the Taliban, which views Isis as a rival, condemned the attacks, adding that they had occurred “in an area where US forces are responsible for security”.

The airport has been inundated by crowds of desperate Afghans trying to flee the country. The US and UK issued separate warnings about an imminent terrorist attack on Thursday. A number of Nato countries, including Canada, have ended their evacuation efforts.

Biden said he had ordered military commanders to “develop operational plans to strike Isis-K assets, leadership and facilities”, referring to the Isis branch in central Asia. The US would “respond with force and precision” at a moment and location of Washington’s choosing, he added.

He called the American dead “heroes who have been engaged in a dangerous selfless mission to save the lives of others”, before reiterating his case for ending the 20-year war that had started in the aftermath of the September 11 attacks.

“I have never been of the view that we should be sacrificing American lives to try to establish a democratic government in Afghanistan,” Biden said, arguing that it had never been a “united country” and was made up of tribes that had never “gotten along with one another”.

“Ladies and gentlemen, it was time to end a 20-year war,” he said.

Ending the US-led “forever war” in Afghanistan has been a pillar of Biden’s foreign policy and remains popular with the war-weary American public. But the chaotic withdrawal has exposed the White House to criticism from US allies and opened up an avenue for political attacks from Republicans.

“Terrorists will not stop fighting the United States just because our politicians grow tired of fighting them,” Mitch McConnell, the top Senate Republican, said. “I remain concerned that terrorists worldwide will be emboldened by our retreat, by this attack, and by the establishment of a radical Islamic terror state in Afghanistan.”

Biden’s popularity ratings have fallen sharply in the past week, with more Americans expressing disapproval than support for the job he was doing for the first time in his presidency, according to several nationwide polls.

The president’s efforts to project resolve were punctured by a testy exchange with reporters after his statement. Biden was asked by Fox News if he accepted any “responsibility” for the attack on US troops, prompting him to criticise Donald Trump, the former president, for the original withdrawal agreement with the Taliban.

“I bear responsibility for fundamentally all that’s happened of late,” he said. “But here’s the deal . . . you know, as well as I do that, the former president made a deal with the Taliban.”

Despite pressure from US allies to delay the withdrawal to allow more time for evacuations, Biden has stuck to the August 31 deadline and showed no inclination to change the mission after the attacks.

US officials have noted that the airlift that began in mid-August has led to the evacuation of 104,000 people, including about 5,000 Americans. However, about 1,000 Americans remain and thousands more Afghans have been trying to leave. Biden suggested on Thursday that some of them would be left behind.

“I know no conflict . . . where, when a war was ending, one side was able to guarantee that everyone who wanted to be extracted from that country would get out,” he said.