Two guards and five fighters have been killed in a suicide attack on the national headquarters of the National Directorate of Security, NDS, Afghanistan's spy agency, officials said.

"There were five attackers involved. The first detonated a car bomb at the gate, the other four were shot dead by police and NDS guards as they approached," Sediq Sediqqi, spokesman for the ministry of interior, said.

Sediqqi added that 30 people, including civilians, were wounded in Wedneday’s attack.

In a text message to AFP the Taliban claimed responsibility for the attack, saying that "a large number of intelligence workers were killed and wounded". However, in an earlier report, the Reuters news agency, said Zabiullah Mujahid, a spokesman for the group, said the Taliban was "unaware" of the attack.

A senior police officer said two guards from the National Directorate of Security intelligence agency were killed and others wounded.

Hamid Karzai, Afghan president, congratulated the "bravery and speed" with which Afghan forces responded to the attack.

Reporting from Kabul, Al Jazeera’s Bernard Smith said, “We understand this was planned to be a large scale assault on the headquarters of Afghanistan’s intelligence department.”

Smith added that the attack happened in a very busy area of the Afghan capital and nearby shop windows were all shattered as a result of the attacks.

Wednesday's attack marks the second targeting the spy agency of the Central Asian nation. In December, Asadullah Khalid, NDS chief, was severely injured in an assassination attempt at one of the agency's guest houses in the Afghan capital.

The agency has been accused of torture by human rights groups and former prisoners.

Gunshots continued to ring out throughout the heavily guarded neighbourhood about half an hour later as a plume of smoke rose into the sky.