The US formally began withdrawing its last troops from Afghanistan on May 1, bringing its longest war nearer to an end but also heralding an uncertain future for a country in the tightening grip of an emboldened Taliban.

US officials on the ground say the withdrawal is already a work in progress – and May 1 is just a continuation – but Washington has made an issue of the date because it is a deadline agreed with the Taliban in 2020 to complete the pullout.

The skies above Kabul and nearby Bagram airbase have been buzzing with more US helicopter activity than usual as the pullout gears up, following the start on April 29 of a concurrent NATO withdrawal.

Afghan security forces were on high alert for any possible Taliban attacks on retreating US troops.

The US military said it had carried out a "precision strike" after an airfield in the southern province of Kandahar where it has a base was attacked.

The strike, which the military said destroyed more rockets aimed at the airfield, came after the base "received ineffective indirect fire" on May 1 afternoon that caused no damages.

"The Americans will formally begin their withdrawal from Afghanistan starting May 1 and the Taliban might increase the violence," acting interior minister Hayatullah Hayat told top police commanders, according to an audio clip given to reporters.

Afghan acting defence minister Zia Yasin said US and allied troops will be leaving their bases and will gather at Bagram, the biggest US base in Afghanistan.

From there "they will go to their respective countries", Yasin told reporters.

The prospect of an end to the US presence after 20 years comes despite fighting raging across the countryside in the absence of a peace deal.

A stark reminder of what remains came late on April 30 with a car bomb in Pul-e-Alam, south of the capital, killing at least 24 people and wounding 110 more.

US President Joe Biden is determined to end what he called "the forever war", announcing last month that the withdrawal of the remaining 2,500 US forces would be complete by the 20th anniversary of the September 11 attacks.

"A horrific attack 20 years ago … cannot explain why we should remain there in 2021," he said.

The Taliban said the US troop withdrawal was to be completed by May 1 as agreed in last year's accord with Washington, and warned it was a "clear violation" that the troops were not fully out.

"This in principle opens the way for our mujahideen to take appropriate action against the invading forces," Mohammad Naeem, a Taliban spokesman told AFP, adding that the group was awaiting orders from its leaders.

Since the US withdrawal deal was struck the Taliban have not directly engaged foreign troops, but have mercilessly attacked government forces in the countryside and waged a terror campaign in urban areas.

The exit of US forces has only exacerbated the fear felt by ordinary Afghans.

"Everyone is scared that we might go back to the dark days of the Taliban era," said Mena Nowrozi, who works at a private radio station in Kabul.

"The Taliban are still the same; they have not changed. The US should have extended their presence by at least a year or two," she told AFP.

Afghan President Ashraf Ghani insists that government forces – which for months have carried out most of the ground fighting against the Taliban – are "fully capable" of keeping the insurgents at bay.

He said the pullout also means the Taliban have no reason to fight.

"Who are you killing? What are you destroying? Your pretext of fighting the foreigners is now over," Ghani said in a speech this week.

Still, General Mark Milley, chairman of the US Joint Chiefs of Staff, has not ruled out total chaos.

"On the worst-case analysis, you have a potential collapse of the government, a potential collapse of the military," he said earlier this week.

"You have a civil war and all the humanitarian catastrophe that goes with it."

Police officer Abdul Malik from the former insurgent bastion of Kandahar said they were prepared.

"We have to take care of our homeland … We will do our best to defend our soil," he told AFP.

The US-led military onslaught in Afghanistan began in October 2001 in the aftermath of the September 11 attacks.

Two decades later, and after the death of almost 2,400 US citizens and tens of thousands of Afghans, Biden says the final withdrawal was justified as US forces had now made sure the country cannot again become a base for foreign jihadists to plot against the West.

Concerns are high that the Taliban might yet strike at retreating US forces, and in the southern province of Kandahar – where the foes used to clash regularly – security sources say several areas are laden with explosives planted by the insurgents.

"If the Taliban attack retreating US or allied forces, it would be to bloody the nose of a defeated enemy and to humiliate it further," said Afghanistan specialist Nishank Motwani.