KABUL, Afghanistan — A suicide bomber killed six policemen after detonating his explosive vest at the entrance gates of the Interior Ministry headquarters on Wednesday, ministry officials said, penetrating nearly to the heart of the Afghan security establishment.

Wearing a military uniform, the attacker got through two security checkpoints. At the third one, in front of the gates, he set off an explosive amid a group of policemen heading into work at the ministry, which is in charge of Afghanistan’s police forces. The headquarters is on a heavily guarded street that is also home to several Western embassies.

The Taliban claimed responsibility for the attack, and said hundreds of Afghan policemen had been killed or wounded.

The bombing came after a series of Taliban attacks in the capital on foreign targets, as well as two on election facilities, amid heavy security in preparation for Saturday’s presidential election.