The Taliban claimed responsibility for the attack. Spokesman Zabiullah Mujahid said insurgents infiltrated the ministry and planned the attack to coincide with the visit of the French defense minister -- who they believed was meeting with officials inside the compound. Mujahid said there were suicide attackers in addition to gunmen.

French officials said the minister, Gerard Longuet, was not inside the ministry during the attack.

The assailant opened fire on his fellow soldiers in the ministry compound in Kabul and was killed in the ensuing shootout, spokesman Gen. Mohammad Zahir Azimi said. He said there were other deaths but he did not know how many. He spoke by phone and was not inside the ministry.

The two accounts could not be immediately reconciled.

Reporters were not allowed inside the ministry after the shooting. Extra guards took up positions at the entrances to the compound and security forces closed the road, but the area appeared calm from the outside.

Azimi did not have any information about whether there was an explosion or suicide attackers involved.