Media playback is unsupported on your device Media caption Insurgents bombed the military intelligence base in Wardak province

Dozens of Afghan security staff were killed by Taliban militants who overran a military intelligence base near Kabul, officials have confirmed.

At least 43 people were killed and 54 injured in Monday's attack, the NDS intelligence service told the BBC.

Insurgents blew their way into the base using a car bomb before opening fire. Some reports put the toll at over 100.

It is one of the deadliest attacks on the secret service and follows a string of battlefield setbacks for the army.

The attack on the National Directorate for Security (NDS) base in central Wardak province came hours before the Taliban held another round of peace talks with US diplomats in Qatar.

Reports say the base in Maidan Shahr, about 30km (19 miles) south-west of Kabul, is a training centre for pro-government militia members.

What happened in the attack?

The militants smashed their way in by detonating a captured Humvee packed with explosives. At least two gunmen then opened fire in the compound.

A second car bombing attempt was foiled by the Afghan security forces and three would-be suicide attackers were killed, the NDS told the BBC.

The Taliban said on Monday they had attacked an Afghan special forces unit and 190 people had been killed. The group often inflates casualty figures from their attacks.

Image copyright EPA Image caption Much of the building's roof collapsed, causing most of the casualties

Officials initially acknowledged about 20 deaths but the latest unconfirmed reports say some 70 bodies have so far been pulled from the rubble.

Most casualties were caused by the partial collapse of the building's roof when it was hit by the force of the Humvee blast.

How did we get to this point?

The Taliban, who emerged in the early 1990s, ruled Afghanistan from 1996 to 2001, but were driven from power by US-led troops following the 9/11 attacks.

They remained a powerful insurgent force, and their power and reach surged after foreign combat troops left Afghanistan in 2014.

US-led combat operations against them officially ended in that year, but some foreign troops remain in the country to provide training and assistance to Afghan forces, who do most of the fighting.

However, the US has been carrying out a sustained air bombing campaign since President Trump announced a new strategy in 2017. It emerged late last year he is planning to withdraw thousands of troops within months.

Media playback is unsupported on your device Media caption The BBC is given rare access to see life under the Taliban

US officials and Taliban representatives have met several times since last summer. President Ashraf Ghani's administration says it must be part of talks too, but the Taliban dismiss his government as puppets of the US.

The Taliban frequently carry out deadly attacks targeting military bases, soldiers and police and in recent years US and Afghan officials have withheld detailed casualty figures as they are deemed too sensitive.

Late last year, President Ghani said more than 28,000 Afghan police and soldiers had been killed since 2015 - an average of about 20 a day.

Civilians, however, continue to bear the brunt of the conflict. The UN Assistance Mission in Afghanistan (Unama) says civilian deaths for the first nine months of 2018 were higher than at any point during the same period since 2014.

Nearly half of all civilian casualties were caused by militant bombings, the UN said, followed by fighting on the ground and targeted killings. Aerial operations by US-backed forces were another significant cause of the casualties.