The U.S. military has vacated its most important airfield in Afghanistan, defense officials said Friday, a strategic and emotional milestone in a 20-year U.S. war that the Pentagon is preparing to end.

But there were signs on Friday that disintegrating security in Afghanistan is causing a partial shift in the speed of the military’s plans. While U.S. officials had said recently they anticipated that Army Gen. Austin “Scott” Miller — the top U.S. commander in Afghanistan for nearly three years — would depart within days, the Pentagon announced on Friday that he will remain in command for several more weeks, as the Biden administration develops plans to continue aerial surveillance and, if needed, carry out counterterrorism strikes without U.S. troops on the ground.

Miller will retain the ability to approve airstrikes to protect U.S. and Afghan forces while he is in command, two defense officials said, speaking on the condition of anonymity because of the sensitivity of the issue. They described the U.S. ability to do so as degraded by the withdrawal, but still possible.

The transfer of Bagram air base to Afghan forces was completed with no ceremony or fanfare, a quiet end at a base that was for years the nerve center of the U.S. counterterrorism campaign across Afghanistan. U.S. Special Operations troops based there hunted al-Qaeda, the Islamic State, the Taliban and other militant groups in raids across Afghanistan’s rugged mountains to the east. Fighter jets, drones and cargo planes took off from Bagram’s twin runways day and night. Each of the previous three U.S. presidents visited the airfield during trips to meet the troops.

The base also was the site of detention facilities at which both U.S. troops and CIA interrogators tortured prisoners, according to U.S. government reports and investigations by human rights groups. The United States closed its detention center at Bagram in 2014, U.S. officials said.

The departure from Bagram follows President Biden’s decision in April to withdraw all U.S. troops from Afghanistan by September, ending what he and other critics have called a “forever war.” As the Taliban launched a bloody offensive and encircled numerous provincial capitals, defense leaders last month briefly considered slowing the military’s departure from the air base, officials said, speaking on the condition of anonymity because of the sensitivity of the issue. The Biden administration ultimately decided to continue the withdrawal.

Biden said on Friday morning that “we are on track exactly as to where we expected to be.” He called the withdrawal a “rational drawdown with our allies,” and defended his decision to depart.

“Look, we were in that war for 20 years,” Biden said. “Twenty years.”

But he refused to answer any follow-up questions. “I’m not going to answer any more questions on Afghanistan. Look, it’s Fourth of July.”

For weeks, Bagram, some 45 miles north of Kabul, has been used as a key launchpad for the military’s departure. Hundreds of C-17 flights have removed U.S. equipment and weapons, many of them flying from the air base. Other equipment was destroyed there.

Army Col. Sonny Leggett, a U.S. military spokesman in Afghanistan, said in a statement that the transfer of Bagram to the Afghan government “was an extensive process spanning several weeks,” beginning soon after Biden directed the U.S. military withdrawal.

“All handovers of Resolute Support bases and facilities, to include Bagram Airfield, have been closely coordinated, both with senior leaders from the government and with our Afghan partners in the security forces, including leadership of the locally based units respective to each base,” Leggett said.

The Bagram district governor, Darwish Raufi, expressed irritation with not being included in the process. He said in a statement that the U.S. military left “without coordinating with security and defense forces and in general without coordinating” with the Afghan government and officials in Bagram district.

“Some looters went in, some of them were arrested and some others escaped,” the governor said. “They were in for equipment that they could carry.”

Fawad Aman, an Afghan defense ministry spokesman, said in a tweet that Bagram was handed over to the “ANDSF,” an acronym for Afghan National Defense and Security Forces.

“ANDSF will protect [the] base and use it to combat terrorism,” he said.

Miller met with Afghan President Ashraf Ghani on Friday to discuss how the U.S. and Afghan governments will cooperate after the withdrawal is complete, according to a statement released by the presidential palace.

Pentagon spokesman John Kirby said that when Miller departs, responsibility for U.S. operations in Afghanistan will be assumed by Marine Gen. Kenneth “Frank” McKenzie, the chief of U.S. Central Command. McKenzie, whose headquarters is in Tampa, will put a Navy SEAL officer, Rear Adm. Peter Vasely, in command of a temporary “forward” headquarters in Kabul after Miller departs, Kirby said. Kirby said the withdrawal should be complete by the end of August.

Zabiullah Mujahid, a Taliban spokesman, said in a statement that the group considers the “evacuation” of all U.S. troops from Bagram to be a positive step, and that Taliban leaders still “seek withdrawal of foreign forces from all parts of the country.”

“Such is in the interest of both them & Afghans,” Mujahid added. “Afghans can move closer to peace & security with complete withdrawal of foreign forces.”

Bagram initially was built as a commercial airport in the 1950s, as the United States and the Soviet Union, competing for influence in Afghanistan, poured money into the country during the Cold War. The facility was seized by the Soviet Union in 1979 after it invaded Afghanistan and built up as a military base during the nearly 10-year Soviet occupation. Bagram was taken over by the United States after the 9/11 attacks with the arrival of U.S. troops in the country.

The air base, overlooked by the rugged, snow-tipped Hindu Kush mountains, was where many U.S. troops killed in combat were sent home in “ramp ceremonies,” in which their remains were draped with the U.S. flag. In all, about 2,400 U.S. troops were killed in the war, with 20,000 more wounded. Tens of thousands of Afghan security forces were also killed, along with more than 47,000 civilians, according to United Nations assessments.

The departure from the air base has renewed concerns among lawmakers, veterans and analysts who think the U.S. military should not leave Afghanistan completely.

Rep. Michael Waltz (R-Fla.), a retired Special Forces officer, called the base “by far the biggest symbol of our 20 years of blood and treasure we have expended for all veterans that have served there.”

“As our only base sandwiched between China, Russia and Iran, it’s a huge strategic asset,” Waltz said. “Why are we just giving it away?”

Mick Mulroy, a former CIA paramilitary officer and Pentagon official early in the Trump administration, said that the speed of the U.S. withdrawal from Afghanistan “may be a testament to the logistical capabilities of our force, but it also is not allowing for a buffer to see if the Afghan security forces will hold against the Taliban without our direct support.”

Close air support and casualty evacuation from Bagram were critical assets in the war, said Mulroy, now an ABC News analyst.

“These enablers are often the deciding factor in engagements between our Afghan military and security partners and the Taliban. Engagements that will inevitably become more frequent once a complete U.S. withdrawal happens,” Mulroy said in a text message.

Government interview records obtained by The Washington Post reveal U.S. officials misled the American public about the Afghanistan war for nearly two decades. (Joyce Lee/The Washington Post)

Lawmakers asked senior Pentagon officials during a House Armed Services Committee hearing last week whether it would be possible to keep control of Bagram. Army Gen. Mark A. Milley, chairman of the Joint Chiefs of Staff, responded that “it is not necessary for the United States to stay at Bagram for what we’re going to try to do here with Afghanistan.”

Eighty-one of about 419 district centers in Afghanistan have fallen under Taliban control, Milley said; others are contested by the militants. Sixty percent of the districts under Taliban control fell to the insurgents last year, and the rest in the past few months, the general added.

Miller, speaking to reporters in Kabul this week, raised concerns that Afghanistan could slide into a prolonged civil war after the U.S. military withdrawal.

“The security situation is not good,” Miller said.

Biden administration officials have said the United States will launch strikes in Afghanistan if there is evidence of a terrorist threat against American interests, including from al-Qaeda or the Islamic State.

Missy Ryan and Anne Gearan in Washington and Pamela Constable and Ezzatullah Mehrdad in Kabul contributed to this report.