Media playback is unsupported on your device Media caption The BBC's Bilal Sarwary says the casualty figure would have been higher if a car filled with explosives had detonated

Suicide bombers have attacked a building belonging to Afghanistan's National Directorate of Security (NDS) in the capital, Kabul, officials have told the BBC.

Six suicide attackers and an Afghan security guard were killed. At least 17 civilians were injured.

A minibus was detonated but another bomb-laden car defused, police said.

The Taliban, who have launched several high-profile raids on Kabul, said they were behind the attack.

The BBC's Bilal Sarwary in Kabul says the attacked area is often packed with civilians who come to collect passports and national identity cards at the interior ministry.

Intelligence chief Gen Zaher Zaher told the BBC the clearance operation was now over.

'Huge bang'

The area affected in central Kabul is heavily barricaded - and the NDS compound, which also houses several Western embassies, is surrounded by tall, thick cement walls designed to protect it from bomb blasts.

High-profile attacks on Kabul 22 June 2012: At least 20 people die in Taliban attack on the Spozhmai Hotel near Kabul

15 April 2012: Seven sites including parliament, Nato HQ and foreign embassies attacked

29 October 2011: Suicide bomber attacks bus carrying Isaf staff, killing 13 foreigners and four Afghans

13 September 2011: Gunmen seize unfinished high-rise to fire on Nato HQ and US embassy

19 August 2011: Gunmen storm British Council HQ, killing 12 people

28 June 2011: 22 people die after militant attack on the Intercontinental Hotel

A senior Afghan security official told the BBC that the attackers targeted the NDS unit where suicide attackers and key Taliban commanders are interrogated.

The NDS said that one suicide attacker drove a minibus which exploded outside the NDS building.

Five others, armed with semi-automatic weapons and hand grenades, then fought the security forces for 15 minutes before being killed by guards.

According to the NDS, another vehicle packed with explosives was defused shortly afterwards.

The main explosion took place around noon local time (07:30 GMT). A plume of smoke rose from the area, and gunfire and police sirens were then heard.

One eyewitness, Mohammad Zia, told Associated Press that the vehicle with the bomb inside drove up to the gates of the barricaded NDS building and then was detonated.

A number of wrecked cars could be seen.

Shop owner Qais Ahmad told Reuters: "I was inside the shop when I heard noises and a huge bang. All the windows in my shop were destroyed and injured my head."

Regular attacks

The attack comes shortly after the return from the US of President Hamid Karzai, who was discussing the future of his country after the Nato-led troops withdraw at the end of next year with President Barack Obama.

Image caption The area attacked is often packed with civilians

Wednesday's attack on the embassy area of Kabul is the first since November, when a suicide bomber killed two Afghan security guards and wounded three.

Last month, NDS chief Asadullah Khalid was wounded in a Taliban suicide bombing in the Taymeni area of central Kabul.

The Taliban said the attacker had posed as a peace messenger.

Mr Khalid has been in the job since September and has a reputation for being fiercely anti-Taliban.

Militant groups continue to mount regular attacks in Afghanistan, raising questions as to how the Afghan security forces will cope after 2014.