Indian embassy attack in Afghan's Herat
Afghan security forces take position at the scene of an attack on the Indian consulate in Herat province Reuters

The Indian consulate in the western Afghan province of Herat has been attacked by Islamist militants ahead of the swearing-in of Narendra Modi as prime minister.

In the pre-dawn attack, four suicide bombers, armed with machine guns and rocket-propelled grenades, stormed the diplomatic mission. Security personnel exchanged gunfire with the insurgents for over four hours at the end of which all the four militants were killed.

None of the diplomatic staff were injured.

"Earlier this morning the consulate was attacked. Our brave ITBP [Indo-Tibetan Border Police] personnel and Afghan soldiers were successful in rebutting the attack. All Indian personnel are safe," said India's Foreign Ministry spokesperson Syed Akbaruddin.

No group has claimed responsibility for the attack as yet.

"It's a successful operation. The ITBP killed one intruder and the Afghan army killed three. Firing is over and we are moving inside. There has been no casualty on the Indian side. We are happy with the outcome and there have been no losses on our side. We had prior intelligence information about such attacks and we were prepared," said Director General of ITBP Subhash Goswami.

Shortly after the attack, Modi spoke to the Indian ambassador to Afghanistan, Amar Sinha, and enquired about the situation.

Afghan President Hamid Karzai, who will attend the swearing-in of Modi on 26 May, spoke to Sinha, pledging support.

A couple of months ago, the US consulate in the same city was attacked by Taliban gunmen. Herat is located in Afghanistan's region bordering Iran and is generally considered one of the safest cities.