The attacker struck at the gates of the compound, which houses foreign advisers to the Afghan government as well as the office of the deputy minister for counter-narcotics in the heart of the country's capital, said deputy interior minister, Gen. Mohammad Ayoub Salangi.

The nationality of the killed guards was not immediately disclosed.

Taliban spokesman Zabihullah Mujahid claimed responsibility for the attack in a statement sent to media.

A police spokesman, Sayed Mahdi Kazimi, said the attacker managed to reach the entrance gate of the compound and detonated his motorbike packed with explosives in the morning hours.

The Taliban frequently use roadside bombs and suicide attacks against Afghan and NATO forces and government offices in the country.

Half an hour after the motorcycle bombing, another explosion wounded an Afghan civilian, said Hashmat Stanikzai, a spokesman for the Kabul police chief.

The attacks and the violence are shaping up as a major test of the Afghan government's ability to maintain security in volatile areas after foreign combat troops leave by the end of 2014.