Afghan authorities on Tuesday vowed to retake all the districts lost to the Taliban as the pullout of US forces from the country neared completion.

Hundreds of commandos were deployed to counter the insurgents' blistering offensive in the north, a day after more than 1,000 government troops fled into neighbouring Tajikistan.

The US Central Command announced that the American withdrawal from the country, ordered in April by President Joe Biden, was now more than 90 percent completed, underscoring that Afghan forces were increasingly on their own in the battle with the hardline Islamist Taliban.

Fighting has raged across several provinces, but the insurgents have primarily focused on a devastating campaign across the northern countryside, seizing dozens of districts in the past two months.

Map of Afghanistan
Map showing parts of Afghanistan currently under government control and territories under the influence of the Taliban, including Nerkh, seized by the insurgents on May 11 Photo: AFP / John SAEKI

"There is war, there is pressure. Sometimes things are working our way. Sometimes they don't, but we will continue to defend the Afghan people," National Security Adviser Hamdullah Mohib told reporters.

"We have plans to retake the districts," he added.

The Pentagon said Tuesday they were well on track to completing their pullout of thousands of American forces and civilian contractors by the end of August, just days after turning over the last and largest of seven US bases, Bagram air base north of Kabul, to the Afghan government.

Bagram Base
Afghan forces have been guarding Bagram Air Base since US and NATO forces left Photo: AFP / WAKIL KOHSAR

Pentagon spokesman John Kirby underscored that the US and NATO coalition partners would continue to support Afghan security forces in the fight with the Taliban, even if there were no coalition troops on the ground.

"We still have the authority to assist the Afghans in the field if they need it," Kirby said, specifying the possibility of air strikes.

He also said negotiations were underway to ensure that US civilian technicians, who have been essential to keeping Afghan air force aircraft flying, would be able to stay.

But he underscored that US forces were leaving by August.

"We have spent a lot of time, a lot of effort, a lot of resources in improving the competency and the capability of the Afghan national security forces, and now it's their turn, it's their time, to defend their people."

Bagram Base
The US completely vacated Bagram Air Base Photo: AFP / WAKIL KOHSAR

Troops and pro-government militiamen were deployed in the northern provinces of Takhar and Badakhshan where the Taliban has captured large swathes of territory at lightning speed, often with little resistance.

Afghan defence officials have said they intend to focus on securing major cities, roads and border towns in the face of the Taliban onslaught.

But the fighting in the north has also forced Moscow to close its consulate in the large city of Mazar-i-Sharif, near the border with Uzbekistan.

And the US exit from Bagram, which provided essential air support, has heightened the crisis facing Afghan government forces.

The speed and ease of the Taliban's effective takeover of areas in the north represent a massive psychological blow to the Afghan government.

The area once served as the stronghold for the anti-Taliban Northern Alliance during the gruesome civil war in the 1990s and was never routed by the militants.

President Ashraf Ghani blamed the Taliban for all the "bloodshed and destruction," adding that his government will not "surrender" to the militants, a palace statement said.

But on Monday, more than 1,000 Afghan troops fled into neighboring Tajikistan.

"We had to abandon our base because there was no coordination or interest among our commanders to counter the attack," said one of the soldiers, Mohammad Musa.

But Mohib said the soldiers who fled were returning and rejoining the security forces.

"They may have abandoned their posts because they ran out of ammunition or they ran out of supplies, but by no means has anyone defected to the Taliban," he said.

Meanwhile a psychological war has also been taking shape online.

The Taliban has used social media to post live updates on their takeover of districts and videos of Afghan soldiers surrendering.

The Afghan government in turn has released its own footage of air strikes on Taliban positions, boasting of inflicting heavy casualties on the jihadist group.

But the government appears to have been embarrassed by the stealthy US exit from Bagram early Friday morning, leaving many Afghans surprised and the base unoccupied for hours.

Kirby, the Pentagon spokesman, said that Afghan officials were told of the impending departure two days ahead of time, but not given the specific time.

"The exact hour of departure was not divulged for operational security purposes," Kirby said.

"In general we felt it was better to keep that information as closely held as possible," he said.

Copyright AFP. All rights reserved.