The catastrophic attacks at the Kabul airport on Thursday stunned Biden administration officials, in part because they had received detailed intelligence reports warning that such an assault was likely, yet couldn’t manage to prevent the bloodiest day for U.S. forces there in years.

The horrific body count included 13 U.S. service members killed and 18 wounded at an entry gate to the airport grounds, along with many Afghans killed or wounded there and at a nearby hotel. U.S. officials believe the attackers were members of a group known as the Islamic State in Khorasan, or ISIS-K, deadly rivals of the Taliban fighters who now hold power in Kabul.

At a White House already badly shaken by events, this was a new shock. “I don’t know if I’ve ever seen this level of sadness and horror,” one official said on Thursday. The White House had received intelligence on Wednesday that a coordinated, multipronged attack at the airport by ISIS-K could be coming — and struggled unsuccessfully to avert it.

President Biden, grim but resolute during a late afternoon news conference, called it a “tough day.” He swore revenge against the ISIS-K terrorists who had attacked U.S. forces. “We will not forgive, we will not forget. We will hunt you down and make you pay.” That sounded like a presidential directive to the CIA’s drone operators.

Biden was unapologetic about his withdrawal policy, which was meant to remove Afghanistan from the national agenda, but triggered a collapse of the government in Kabul that has brought new suffering and grief. He said of the continuing U.S. airlift of refugees from Kabul, under threat from the ISIS-K militants: “Knowing the risk, this is the right thing to do.”

The State Department had warned Americans, hours before the bombings, to stay away from the airport entry points. But U.S. officials lacked precise intelligence to stop attackers in the chaos surrounding the airport. U.S. officials sought help from the Taliban, but the airport proved to be an indefensible position. A senior Pentagon official cautioned during an interview that “we’re not out of the woods yet” because there’s intelligence that ISIS-K may be planning another attack.

The carnage at the perimeter wall of Kabul airport was captured in cellphone videos: bodies strewn across the target zone, some stacked atop others by the blast; rescue workers transporting maimed survivors to emergency medical facilities. In one grim video, the sole sound was a lamentation by a grieving Afghan man.

The Biden administration continues its unlikely security partnership with the Taliban, a bitter enemy less than two weeks ago. That cooperation was symbolized by Monday’s meeting in Kabul between CIA Director William J. Burns and Taliban leader Abdul Ghani Baradar. Sources said they talked about security arrangements that might allow a reopening of the U.S. Embassy, which the Taliban wants. Baradar stiffened when Burns raised the issue of whether the United States might remain at the Kabul airport after Aug. 31, the sources said.

The United States has raced to evacuate Americans and Afghan allies to meet that deadline, and the airlift has flown more than 100,000 people to safety. But the rescue effort, impressive as it has been, has left behind perhaps a thousand Americans and many times more Afghans.

For the tens of thousands of Afghans who have departed from Kabul, and the nations to which they are fleeing, severe problems remain. Resettlement in the United States will be difficult for Afghans who are unvaccinated and, for many Americans, unwelcome. Many of those who rushed aboard emergency evacuation flights lack necessary documents. And the Afghans trekking out across borders could cause serious security and humanitarian problems for nearby countries such as Pakistan, Russia, China and Iran.

The catastrophe in Kabul has spawned some finger-pointing and second-guessing in what has been a congenial Biden administration. To some White House officials, the military followed Biden’s order to withdraw troops all too quickly, with its commander and most forces gone by early July.

The Pentagon counters that the timetable was explicitly endorsed by the White House. Officials across the government complain that the State Department failed to reduce staffing at the embassy soon enough or to prepare visa paperwork for the thousands of Afghan civilians who would need to be evacuated if Kabul fell. And while the CIA warned that the Afghan government was shaky, even pessimists thought it might not fall until October or November.

Biden sought to calm that discord Thursday with an embrace of a military that is grieving. But rest assured: When the histories are written, there will be enough blame for all to share. For today, too much sorrow.