For nearly 20 years, Bagram Airfield was the heart of American military power in Afghanistan, a sprawling mini-city behind fences and blast walls just an hour’s drive north of Kabul. Initially, it was a symbol of the U.S. drive to avenge the 9/11 attacks, then of its struggle for a way through the ensuing war with the Taliban.

In just a matter of days, the last U.S. soldiers will depart Bagram. They are leaving what probably everyone connected to the base, whether American or Afghan, considers a mixed legacy.

MILITIAS FIRE ROCKETS AT US FORCES IN SYRIA FOLLOWING AIRSTRIKES

"Bagram grew into such a massive military installation that, as with few other bases in Afghanistan and even Iraq, it came to symbolize and epitomize the phrase ‘mission creep’," said Andrew Watkins, Afghanistan senior analyst for the Brussels-based International Crisis Group.

U.S. Central Command said last week that it’s well past 50% done packing up Bagram, and the rest is going fast. American officials have said the entire pullout of U.S. troops will most likely be completely finished by July 4. The Afghan military will then take over Bagram as part of its continuing fight against the Taliban — and against what many in the country fear will be a new eruption of chaos.

FILE - In this Dec. 24, 2017 file photo, Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff speaks during a ceremony on Christmas Eve at Bagram Air Base, in Afghanistan. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base. (AP Photo/Rahmat Gul, File)

FILE - In this Dec. 24, 2017 file photo, Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff speaks during a ceremony on Christmas Eve at Bagram Air Base, in Afghanistan. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base. (AP Photo/Rahmat Gul, File)

The departure is rife with symbolism. Not least, it’s the second time that 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 it into its main base from which it would defend its occupation of the country. 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.

The Soviet Union negotiated its withdrawal in 1989. Three years later, the pro-Moscow government collapsed, and the mujahedeen took power, only to turn their weapons on each other and kill thousands of civilians. That turmoil brought to power the Taliban who overran Kabul in 1996.

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.

After dislodging the Taliban from Kabul, the U.S.-led coalition began working with their warlord allies to rebuild Bagram, first with temporary structures that then turned permanent. Its growth was explosive, eventually swallowing up roughly 30 square miles.

"The closure of Bagram is a major symbolic and strategic victory for the Taliban," said Bill Roggio, senior fellow at the Foundation for the Defense of Democracies.

FILE - In this May 26, 2020 file photo, prisoners are released from Bagram Prison inside Bagram Air Base, in Afghanistan. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base.  (AP Photo/Rahmat Gul, File)

FILE - In this May 26, 2020 file photo, prisoners are released from Bagram Prison inside Bagram Air Base, in Afghanistan. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base.  (AP Photo/Rahmat Gul, File)

"If the Taliban is able to take control of the base, it will serve as anti-U.S. propaganda fodder for years to come," said Roggio who is also editor of the foundation’s Long War Journal.

It would also be a military windfall.

The enormous 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. There are also fitness centers and fast food restaurants. Another section houses a prison, notorious and feared among Afghans.

Jonathan Schroden, of the U.S.-based research and analysis organization CNA, estimates that well over 100,000 people spent significant time at Bagram over the past two decades. "Bagram formed a foundation for the wartime experience of a large fraction of U.S. military members and contractors who served in Afghanistan," said Schroden, director of CNA’s Center for Stability and Development.

"The departure of the last U.S. troops from there will likely serve as the final turn of the page for many of these folks with respect to their time in that country," he said.

For Afghans in Bagram district, a region of more than 100 villages supported by orchards and farming fields, the base has been a major supplier of employment. The U.S. withdrawal effects nearly every household, said Darwaish Raufi, district governor.

FILE - In this May 3, 2021 file photo, a man rests in the shade of destroyed machinery sold by the US military to a scrapyard, outside Bagram Air Base, in Afghanistan. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base. (AP Photo/Rahmat Gul, File)

FILE - In this May 3, 2021 file photo, a man rests in the shade of destroyed machinery sold by the US military to a scrapyard, outside Bagram Air Base, in Afghanistan. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base. (AP Photo/Rahmat Gul, File)

The Americans have been giving the Afghan military some weaponry and other material. Anything else that they are not taking, they are destroying and selling it to scrap dealers around Bagram. U.S. officials say they must ensure nothing usable can ever fall into Taliban hands.

Last week, the U.S. Central Command said it had junked 14,790 pieces of equipment and sent 763 C-17 aircraft loaded with material out of Afghanistan. Bagram villagers say they hear explosions from inside the base, apparently the Americans destroying buildings and material.

Raufi said many villagers have complained to him about the U.S. leaving just their junk behind.

"There’s something sadly symbolic about how the U.S. has gone about leaving Bagram. The decision to take so much away and destroy so much of what is left speaks to the U.S. urgency to get out quickly," said Michael Kugelman, deputy director of the Asia Program at the U.S.-based Wilson Center.

"It’s not the kindest parting gift for Afghans, including those taking over the base," he said.

Inevitably, comparisons to the former Soviet Union have arisen.

Retired Afghan Gen. Saifullah Safi, who worked alongside U.S. forces at Bagram, said the Soviets left all their equipment when they withdrew. They "didn’t take much with them, just the vehicles they needed to transport their soldiers back to Russia," he said.

The prison in the base was handed over to the Afghans in 2012, and they will continue to operate it. In the early years of the war, for many Afghans, Bagram became synonymous with fear, next only to Guantanamo Bay. Parents would threaten their crying children with the prison.

Zabihullah, 30, who spent six years in Bagram prison inside Bagram Air Base accused of crimes he denies, hides his face as he speaks during an interview with the Associated Press in Kabul, Afghanistan, Saturday, June 26, 2021. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base. (AP Photo/Rahmat Gul)

Zabihullah, 30, who spent six years in Bagram prison inside Bagram Air Base accused of crimes he denies, hides his face as he speaks during an interview with the Associated Press in Kabul, Afghanistan, Saturday, June 26, 2021. In 2001 the armies of the world united behind America and Bagram Air Base, barely an hours drive from the Afghan capital Kabul, was chosen as the epicenter of Operation Enduring Freedom, as the assault on the Taliban rulers was dubbed. It’s now nearly 20 years later and the last US soldier is soon to depart the base. (AP Photo/Rahmat Gul)

In the early years of the invasion, Afghans often disappeared for months without any reports of their whereabouts until the International Red Committee of the Red Cross located them in Bagram. Some returned home with tales of torture.

"When someone mentions even the word Bagram I hear the screams of pain from the prison," said Zabihullah, who spent six years in Bagram, accused of belonging to the faction of Gulbuddin Hekmatyar, a warlord designated a terrorist by the U.S. At the time of his arrest it was an offense to belong to Hekmatyar's party.

CLICK HERE FOR THE FOX NEWS APP  

Zabihullah, who goes by one name, was released in 2020, four years after President Ashraf Ghani signed a peace deal with Hekmatyar.

Roggio says the status of the prison is a "major concern," noting that many of its prisoners are known Taliban leaders or members of militant groups, including al-Qaida and the Islamic State group. It's believed about 7,000 prisoners are still in the prison.

"If the base falls and the prison is overrun, these detainees can bolster the ranks of these terror groups," Roggio said.