The Taliban has claimed responsibility for the attack.

In depth


 
Video: Presidential poll test for Afghanistan's security
 Riz Khan: Seeds of terror
 Focus: US trapped in 'bitter war'?
 Focus: New challenges in Afghan offensive
 Focus: Switching sides in Afghanistan

Attacks on security forces have increased as Afghans gear up for a presidential election scheduled for August 20.

However, the attacks have come mainly in the south where Taliban fighters have their strongest presence.

James Bays, Al Jazeera's correspondent in Kabul, the Afghan capital, said: "We have certainly seen a lot of violence during the election campaign already and we still have just less than three weeks to go until polling day.

“I think what's significant is that this [attack took place in] Herat, a relatively peaceful city, a relatively prosperous city here in Afghanistan near the Iranian border ... but attacks there have been on the increase," he said.