“People will die and they will be left behind,” said McCaul.

Mr Biden has stressed that he takes the threat to American security in Kabul seriously. In a closed meeting with the leaders of the Seven Nations Group on Tuesday, the president told them the risk of a terrorist attack was “very high,” according to a senior American official.

A deadly attack by ISIS-K on American and Afghan civilians would be a catastrophe not only for the United States but also for the Taliban, who want to consolidate control over Kabul. The Taliban and the Islamic State were enemies and fought for control of parts of the country on the battlefield.

Understanding the Taliban takeover in Afghanistan

Map 1 of 5

Who are the Taliban? The Taliban emerged in 1994 amid the unrest following the withdrawal of Soviet forces from Afghanistan in 1989. They used brutal public punishments, including flogging, amputation and mass executions, to enforce their rules. Here is more about their genesis and track record as rulers.

Who are the Taliban leaders? These are the top leaders of the Taliban, men who for years have been on the run, in hiding, in prison and dodged American drones. Little is known about them or how they plan to rule, including whether they will be as tolerant as they say they are.

What is happening to the women of Afghanistan? When the Taliban was last in power, they banned women and girls from most jobs or from going to school. Afghan women have gained a lot since the Taliban was overthrown, but now they fear that they are losing ground. Taliban officials are trying to reassure women that things will be different, but there are indications that they have begun to reintroduce the old order in at least some areas.

ISIS-K refers to the Khorasan offshoot of the Islamic State in Afghanistan.

British Prime Minister Boris Johnson, who chaired the meeting, tried to put the discussions on a good face and said the evacuation had been remarkably successful. He said the leaders had agreed on a roadmap for long-term dealings with the Taliban and vowed to use Afghan funds in Western banks as leverage to put pressure on the Taliban.

“Condition # 1 is that they must guarantee safe passage for those who want to get out by August 31st and beyond,” Johnson told the BBC after the meeting.

But Mr Johnson failed in his efforts to persuade Mr Biden to extend the evacuation beyond August 31, and it was not clear what other options the allies had to protect their own citizens and Afghan allies without American military power.

Chancellor Angela Merkel said there were plans to find a way to ensure that “we can still get as many local workers and vulnerable people to leave the country” afterwards. But her sober tone exposed the sense of futility Western leaders felt about Afghanistan.

“How can it be that the Afghan leader left the country so quickly?” said Mrs. Merkel. “How can it be that Afghan soldiers who we trained for so long gave up so quickly? We will have to ask ourselves these questions, but they were not the most urgent today. “