Four heavily armed fighters, including suicide bombers, have launched a rocket propelled grenade and gun attack on the Indian consulate in Afghanistan's western city of Herat, according to Afghan and Indian government officials.

Police said Afghan security forces killed the attackers, who were holed up in buildings overlooking the consulate, following a firefight on Friday that lasted several hours.

Indian staff at the mission escaped soon after the shooting began at around 3am. 

"They fired a couple of RPG shots. It was dark and they couldn't verify where it was coming from," Amar Sinha, India's ambassador in Kabul, told Reuters news agency by telephone.

He said there had been around 10 staff resident at the consulate in Herat, which stands close to the border with Iran and is Afghanistan's third largest city.

General Samihullah Qatra, the local police chief, told Reuters that four attackers, including suicide bombers, had entered houses close to the consulate before dawn and began shooting into the compound.

Live Box 201239113414952721

"There were three suicide bombers armed with AK-47, RPG, hand grenade and suicide vests. Our security forces killed all of them. Only five of our security forces were wounded."

The attack underscored Afghanistan's security vulnerability, as the country prepares to take over from foreign combat troops after 12 years of war and prepares for a presidential election run-off next month.

Nine civilians, including seven children, were killed in August last year when suicide bombers targeted the Indian consulate in the eastern Afghan city of Jalalabad by detonating an explosives-packed car.

India has more than $2bn of investments in Afghanistan, including roads and power projects.

It was not immediately clear who was behind the attack and no claims of responsibility have been made so far, although the Taliban often carry out such attacks on Afghan and international targets around the country.

Groups known for targeting Indian interests in the region include Lashkar-e-Taiba, which was blamed for the 2008 attack on the Indian city of Mumbai that killed 166 people, and the Haqqani network, which is based in Pakistan's lawless tribal areas along the border with Afghanistan.

Source: Agencies