The U.S. intelligence community saw it coming.

According to a new report in The New York Times, “classified assessments by American spy agencies over the summer painted an increasingly grim picture of the prospect of a Taliban takeover of Afghanistan and warned of the rapid collapse of the Afghan military.” The fall of Kabul, the nation’s capital, was a particular concern.

The intelligence warnings of a “cascading collapse” and the quick capitulation of Afghanistan’s fighting forces proved prescient; the Taliban is now in control of the country after government forces yielded city after city without significant resistance. In the past week, the U.S. had to scramble to secure its embassy in Kabul. The effort to evacuate diplomats and Afghan citizens who assisted the American war effort was chaotic.

But the Biden administration had a more optimistic – and ultimately, incorrect – projection of events on the ground following the departure of U.S. troops. On July 8th, President Biden said the Afghan government was unlikely to fall and, according to a newspaper report at the time, “Biden grew testy [with reporters] as he rejected the likelihood that Americans would have to flee from Kabul as they did from Saigon in 1975. He insisted that the United States had done more than enough to empower the Afghan police and military to secure the future of their people. “

On Monday, Biden admitted that the Taliban takeover “did unfold more quickly than we had anticipated,” but he insisted that his administration planned for every contingency.

“If anything, the developments of the past week reinforce that ending U.S. military involvement in Afghanistan now was the right decision,” Biden added. The president said if the Afghan military is unwilling to fight the Taliban, American soldiers should not be stuck with the burden.

The new report from The New York Times notes that key decisions about America’s withdrawal from Afghanistan took place before the intelligence community coalesced around a pessimistic outlook for the country. As late as this spring, the consensus indicated that the Afghan government could hold off the Taliban in the near term. From the Times:

On April 27, when the State Department ordered the departure of nonessential personnel from the embassy in Kabul, the overall intelligence assessment was still that a Taliban takeover was at least 18 months away, according to [Biden] administration officials.

But when that outlook grew more dire this summer, military brass was reluctant to accept reality. The Times reports:

At the core of the American loss in Afghanistan was the inability to build a security force that could stand on its own, but that error was compounded by Washington’s failure to listen to those raising questions about the Afghan military.

Part of the problem, according to former officials, is that the can-do attitude of the military frequently got in the way of candid accurate assessments of how the Afghan security forces were doing. Though no one was blind to desertions or battlefield losses, American commanders given the task of training the Afghan military were reluctant to admit their efforts were failing.