The Afghanistan disaster has rocked the Biden administration’s foreign policy team, which may need months to regain its sense of balance and momentum.

Senior officials don’t have time or emotional bandwidth now for broad questions about what’s next for U.S. foreign policy. In the sleepless days and nights of the past week, the White House has been focused — and sometimes shaken — by the chaos of the Taliban takeover in Kabul.

The diplomatic calendar is fixed. The United Nations General Assembly meets in New York in September; the Group of 20 meets in Rome on Oct. 30; the United Nations Climate Change Conference, known as COP-26, will begin in Glasgow, Scotland, on Nov. 1; a “summit of democracies” is tentatively planned for December. But administration officials expect that all these events will be shadowed by humanitarian, refugee and security issues caused by the ruinous mess in Afghanistan.

The reversals in Afghanistan are confounding for a Biden national security team that has rarely known personal failure: Jake Sullivan, the national security adviser, went to Yale, Oxford and Yale Law School. Antony Blinken, secretary of state, attended Harvard and Columbia Law.

These are America’s best and brightest, who came to the messy endgame of the Afghanistan war with spotless résumés. That’s one of the parallels to the Vietnam War, where a similar group of brilliant policymakers who had rarely experienced failure was confounded by an obdurate enemy from another century. The U.S. foreign policy establishment of the 1960s hit a wall with Vietnam and never fully recovered. We’ll see what happens with the Biden team.

The sudden collapse of the Afghan government and the nightmare at Kabul airport stunned senior officials. They knew that the situation was fragile, and intelligence analysts had predicted that the government of President Ashraf Ghani would likely fall soon. But one sign that the CIA didn’t foresee an imminent collapse was that Director William J. Burns was traveling in the Middle East last week on a six-day trip and didn’t return until Sunday, the day Kabul fell, just a day before he had planned.

White House officials thought they had enough time to conduct an orderly withdrawal of American citizens and Afghans who had worked with U.S. forces — and they wanted to avoid the panic that might be caused by a more rapid evacuation. Indeed, when Ghani visited the White House on June 25, his main request was that Biden slow the departure of Americans and Afghans who had served as translators or contractors to avoid the destabilizing appearance of a rush for the exit.

Biden’s problem on Afghanistan was partly that it was too personal. He remained peeved after 2009, when as vice president his advice for a limited counterterrorism force there was rejected by Barack Obama. When Biden became president, he was determined to get the remaining 2,500 troops out of the country. As military leaders pressed him to keep that force, Biden only dug in his heels.

Gen. Austin “Scott” Miller, the last U.S. commander in Afghanistan, warned Biden that “it’s going to be bad and it’s going to be fast,” according to one friend of Miller’s. Biden was worried, but he didn’t budge.

Biden offered a tangled and somewhat misleading explanation for his decisions in an interview Wednesday with ABC’s George Stephanopoulos. He claimed that his military advisers didn’t argue for keeping the 2,500 troops in Afghanistan. That’s not true; Defense Secretary Lloyd Austin and Gen. Mark A. Milley, chairman of the Joint Chiefs of Staff, urged him to keep the force in place. But they warned him he might have to send more troops if the Taliban decided to escalate.

Failure can shatter the trust and consensus of any team, and that’s a danger now for the Biden White House. This group has been extraordinarily close and congenial during Biden’s first seven months. But you can already see the first cracks in fortress Biden. Liberal Democrats, especially activists for women’s rights, are genuinely angry that Biden didn’t do more to protect Afghan women and human rights. Those fissures will widen.

The Pentagon was keen to move quickly when it became clear Biden could not be convinced to keep U.S. forces in place. “Speed is safety,” the generals advised, and the troops rushed out two months ahead of schedule. But on the evacuation of civilians, Biden tried to tiptoe home. On Aug. 12, just four days before the government collapsed, Pentagon spokesman John Kirby wouldn’t even call the race to withdraw civilians via the Kabul airport a “noncombatant evacuation operation.” That was a Pentagon in denial.

Military planners say the most dangerous maneuver in warfare can be retreat. We’re seeing that now in Afghanistan, and the casualties are likely to be political, too.