A gate is seen at the Bagram Air Base in Afghanistan on Friday. Credit: Rahmat Gul / AP

KABUL, Afghanistan — After nearly 20 years, the U.S. military left Bagram Airfield, the epicenter of its war to oust the Taliban and hunt down the al-Qaida perpetrators of the 9/11 terrorist attacks on America, two U.S. officials said Friday.

The airfield was handed over to the Afghan National Security and Defense Force in its entirety, they said, speaking on condition they not be identified because they were not authorized to release the information to the media.

One of the officials also said the U.S. top commander in Afghanistan, Gen. Austin S. Miller, “still retains all the capabilities and authorities to protect the forces.”

Miller met Afghan President Ashraf Ghani on Friday and according to a Dari-language tweet by the presidential palace, the two discussed “continued U.S. assistance and cooperation with Afghanistan, particularly in supporting the defense and security forces.”

There were no specifics but the U.S. is already committed to paying nearly $4 billion annually until 2024 to finance the Afghan security forces. While no one was calling Miller’s visit a farewell, in the backdrop of the evacuation of Bagram Airfield it had the hallmarks of a goodbye.

Meanwhile, Afghanistan’s district administrator for Bagram, Darwaish Raufi, said the American departure was done overnight without any coordination with local officials, and as a result early Friday, dozens of local looters stormed through the unprotected gates before Afghan forces regained control.

“They were stopped and some have been arrested and the rest have been cleared from the base,” Raufi told The Associated Press, adding that the looters ransacked several buildings before being arrested and the Afghan forces took control.

“Unfortunately the Americans left without any coordination with Bagram district officials or the governor’s office,” Raufi said. “Right now our Afghan security forces are in control both inside and outside of the base.”

However, U.S. military spokesperson Col. Sonny Leggett said the handover was an “extensive process” that spanned several weeks and began soon after President Joe Biden’s mid-April announcement that America was withdrawing the last of its forces.

“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,” said Col. Leggett.

The deputy spokesman for the defense minister, Fawad Aman, said nothing of the early morning looting. He said only the base has been handed over and that Afghan forces will now “protect the base and use it to combat terrorism.”

The Taliban also welcomed the American withdrawal from Bagram Airfield. In February 2020, the Trump administration signed a peace deal with the Taliban promising the withdrawal of all troops from Afghanistan.

Taliban spokesman Zabihullah Mujahid tweeted that Friday’s departure was a “positive step,” urging for the “withdrawal of foreign forces from all parts of the country.”

The withdrawal is the clearest indication that the last of the 2,500-3,500 U.S. troops have left Afghanistan or are nearing a departure — months ahead of Biden’s promise that they would be gone by Sept. 11.

It was clear soon after the mid-April announcement that the U.S. was ending its “forever war,” that the departure of U.S. soldiers and their estimated 7,000 NATO allies would be completed nearer to July 4, when America celebrates its Independence Day.

As of this week, most other NATO soldiers have already quietly exited Afghanistan. Announcements from several countries analyzed by the AP show that a majority of European troops has left with little ceremony — a stark contrast to the dramatic and public show of force and unity when NATO allies lined up to back the U.S. invasion in 2001.

The U.S. has refused to say when the last American soldier would leave Afghanistan, citing security concerns, but also future security and protection for Kabul International Airport is still being negotiated. Turkish and U.S. soldiers are currently protecting the airport, still under Resolute Support Mission, which is the military mission being wound down.

Until a new agreement for the airport is struck by Turkey and the Afghan government, and possibly the United States, it appears the Resolute Support mission would have to continue to be in charge of the facility.

The U.S. will also have about 650 troops in Afghanistan to protect its sprawling embassy in Kabul. Their presence is understood will be covered under a bilateral agreement with the Afghan government.

The U.S. and NATO departure comes as the Taliban make strides in several parts of the country, overrunning dozens of districts and overwhelming beleaguered Afghan security forces.

In a worrying development, the government has resurrected militias with a history of brutal violence to assist Afghan security forces. At what had all the hallmarks of a final press conference, Gen. Miller this week warned that continued violence risked a civil war in Afghanistan.

At its peak in and around 2012, Bagram Airfield saw more than 100,000 U.S. troops pass through the massive compound barely an hour’s drive north of Kabul.

The departure is rife with symbolism, the second time an invader of Afghanistan has come and gone through Bagram.

The Soviet Union built the airfield in the 1950s. When it invaded Afghanistan in 1979 to back a communist government, it turned Bagram into its main base. For 10 years, the Soviets fought the U.S.-backed mujahedeen, dubbed freedom fighters by President Ronald Reagan who saw them as a front-line force in one of the last Cold War battles.

When the U.S. and NATO inherited Bagram in 2001, they found it in ruins, a collection of crumbling buildings, gouged by rockets and shells, most of its perimeter fence wrecked. It had been abandoned after being battered in the battles between the Taliban and rival mujahedeen warlords fleeing to their northern enclaves.

The base has two runways. The most recent, at 12,000 feet long, was built in 2006 at a cost of $96 million. There are 110 revetments, which are basically parking spots for aircraft, protected by blast walls. GlobalSecurity, a security think tank, says Bagram includes three large hangars, a control tower and numerous support buildings. The base has a 50-bed hospital with a trauma bay, three operating theaters and a modern dental clinic. Another section houses a prison, notorious and feared among Afghans.

Story by Kathy Gannon. Associated Press writers Lolita Baldor, Farid Tanha and Rahim Faiez contributed to this report.