Indian staff at the mission escaped soon after the shooting began at around 3 a.m.. Police said Afghan security forces had killed the attackers, who were holed up in buildings overlooking the consulate, following a firefight that lasted several hours.
"They fired a couple of RPG shots. It was dark and they couldn't verify where it was coming from," India's ambassador to Kabul Amar Sinha told Reuters 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.
The consulate was guarded by a team of commandos from the Indo-Tibetan Border Police. Afghan security forces form an outer ring, an Indian security official in New Delhi said.
Herat police chief General Samihullah Qatra told Reuters four attackers, including suicide bombers, had entered houses close to the consulate before dawn and began shooting into the compound.
It was not immediately clear who was behind the attack and no one claimed responsibility, though suspicion would inevitably fall on the Taliban and other loosely associated groups.
NJF/NJF