The Taliban have seized a district from Afghan government forces on the outskirts of Kabul, ahead of a three-day ceasefire agreed between the warring sides, officials said.

Nerkh district is around 40 kilometres (25 miles) from the Afghan capital in neighbouring Wardak province, which has long been used by militants as a gateway to reach Kabul and launch deadly attacks.

Violence has soared since May 1 when the US military began formally withdrawing its last remaining troops, as peace efforts between the Taliban and the Afghan government have stalled.

"Security and defence forces made a tactical retreat from the police headquarters of Nerkh district," Interior Ministry spokesman Tareq Arian told AFP.

Zabihullah Mujahid, a spokesman for the Taliban, said the insurgents had captured the area on Tuesday, adding that their fighters had seized the police headquarters and an army base.

The Defence Ministry on Wednesday said it would launch an offensive to win back the district, home to more than 60,000 people.

"Commando reinforcements are on their way," said Fawad Aman, a spokesman for the defence ministry.

Large swathes of Wardak and neighbouring Logar province have been controlled or contested for years by Taliban fighters and have served as a strategic staging ground for militants hoping to enter Kabul.

The main highway that connects Kabul to southern Kandahar province -- the former Taliban stronghold and the scene of intense fighting in recent weeks -- goes through the district.

Taliban fighters have been encircling major Afghan urban centres, spurring speculation the militants are waiting for the Americans to withdraw before launching all-out assaults on Afghan cities.

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

The capture of Nerkh comes after the Taliban and the Afghan government agreed to observe a three-day ceasefire to mark the Eid al-Fitr holiday starting on Thursday.

Ceasefires in the past have widely held in what is largely thought to be an exercise by the Taliban leadership to prove they have firm control over the myriad factions across the country that make up the jihadist movement.

Violence has intensified across the provinces, particularly in the south, since the United States missed a May 1 deadline agreed with the Taliban to withdraw the last of its troops.

While the Taliban have avoided engaging American forces, attacks against government and civilian targets have not stopped.

Thousands of residents in Helmand have been displaced because of clashes, which saw the US military called in to defend Afghan forces.

In the latest violence to rock Kabul, more than 50 people were killed and scores wounded in a western district of the capital when three bombs exploded outside a girls' school on Saturday.

It was the deadliest attack in more than a year and came as residents were out shopping ahead of Eid.

The US military has so far completed between six and 12 percent of its final withdrawal, the Pentagon said Tuesday.

The Afghan defence ministry announced Wednesday that it had taken control of Camp Morehead, a US base in Kabul where American troops trained the Afghan military.

The camp will now be used by Afghan special forces.

The US military did not offer any immediate comment.