WASHINGTON -- Nearly 20 years after invading Afghanistan to oust the Taliban and hunt down al-Qaida, the U.S. military has vacated its biggest airfield in the country, advancing a final withdrawal that the Pentagon on Friday said will be completed by the end of August.

President Joe Biden had instructed the Pentagon to complete the military withdrawal by Sept. 11, the 20th anniversary of the terrorist attacks on the U.S., but the Pentagon now says it can finish the drawdown a little earlier. In fact, the drawdown is already largely completed and officials had said it could be wrapped up this weekend. But a number of related issues need to be worked out in coming weeks, including a new U.S. military command structure in Kabul and talks with Turkey on an arrangement for maintaining security at the Kabul airport, and so an official end to the pullout will not be announced soon.

"A safe, orderly drawdown enables us to maintain an ongoing diplomatic presence, support the Afghan people and the government, and prevent Afghanistan from once again becoming a safe haven for terrorists that threatens our homeland," Pentagon press secretary John Kirby said.

The administration is meanwhile narrowing options for ensuring the safety of thousands of Afghans whose applications for special visas to come to the United States have yet to be approved. The administration has already said it's willing to evacuate them to third countries pending their visa approvals but has yet to determine where. Officials said Friday that one possibility is to relocate them to neighboring countries in Central Asia where they could be protected from possible retaliation by the Taliban or other groups.

The White House and State Department have declined to comment on the numbers to be relocated or where they might go, but the foreign ministers of Tajikistan and Uzbekistan were both in Washington this week and the subject of Afghan security was raised in meetings they held with Secretary of State Antony Blinken and Defense Secretary Lloyd Austin.

Kirby said that Austin on Friday approved a new command structure in Afghanistan to transition the U.S. military mission from warfighting to two new objectives -- protecting a continuing U.S. diplomatic presence in Kabul and maintaining liaison with the Afghan military.

Austin's plan calls for the top commander in Afghanistan, Army Gen. Scott Miller, to transfer his combat authorities to the Florida-based head of U.S. Central Command, Marine Gen. Frank McKenzie, before relinquishing his command this month. Also, a two-star Navy admiral will head a U.S. Embassy-based military office, dubbed U.S. Forces Afghanistan-Forward, to oversee the new mission of providing security for the embassy and its diplomats.

A satellite military office based in Qatar and headed by a U.S. one-star general will be established to administer U.S. financial support for the Afghan military and police, plus maintenance support provided for Afghan aircraft from outside Afghanistan.

Kirby said Miller, who already is the longest-serving commander of U.S. forces in Afghanistan in the 20 years of warfare, will remain in command for "a couple of weeks" longer but was not more specific. He said Miller will be preparing for and completing the turnover of his duties to McKenzie and also will be traveling inside and beyond Afghanistan.

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."

Bagram Airfield has been the epicenter of the war to oust the Taliban and hunt down the al-Qaida perpetrators of the 9/11 terrorist attacks on America. 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.

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.

However, U.S. military spokesman Col. Sonny Leggett said the handover was an "extensive process" that spanned several weeks and began soon after 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 Taliban welcomed the American withdrawal from Bagram Airfield. 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."

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 to have to continue to be in charge of the facility.

   ------

Gannon reported from Kabul. Associated Press writers Lolita Baldor and Matthew Lee in Washington, Farid Tanha, in Bagram, Afghanistan, and Rahim Faiez in Kabul, contributed to this report.