The Indian consulate in Afghanistan has been attacked by heavily-armed gunmen.<br /><br />The three attackers were killed and five security guards wounded, according to the chief of police.<br /><br />All of the Indian staff managed to escape after the shooting started and were unharmed.<br /><br />The attack began in the early hours of Friday in the western city of Herat, close to the border with Iran.<br /><br />The attackers are reported to have taken over homes overlooking the consulate and used them to shoot on the compound.<br /><br />They were quickly surrounded by security forces and a gun battle lasted several hours.<br /><br />The attack comes as Afghan troops prepare to take over from foreign armies.