Four terrorists armed with rocket-propelled grenades and machine guns attacked the Indian consulate in Herat in western Afghanistan in the early hours of Friday. All the attackers were killed, officials said, adding that the Indian staff was safe.
The attack began at 3.15 a.m. when the four gunmen tried to break into the consulate, located 600 km from Kabul. The audacious attack came ahead of the May 26 swearing-in of Narendra Modi as India's next prime minister. Afghan President Hamid Karzai is to attend the oath-taking ceremony in New Delhi.
Karzai called up the Indian Prime Minister-designate and spoke to him for about 10 minutes and assured him that Afghanistan would "do all possible to protect Indian missions in Afghanistan".
"The well-trained suicide bombers, armed with machine guns and rocket-propelled grenades, were killed in a joint operation by the Indo-Tibetan Border Police (ITBP) and Afghanistan forces," said an official press statement issued by the Gujarat government.
"Modi thanked Karzai for the efforts of Afghanistan forces in thwarting the attack on the Indian mission."
Modi also tweeted: "I condemn the attack on our consulate in Herat, Afghanistan. Closely monitoring the situation. I have spoken to the Ambassador as well."
Syed Akbaruddin, Indian external affairs ministry spokesperson, said that all the staff of the consulate were safe.
"Our premises have been repeatedly attacked by those who do not support India's development work in Afghanistan. The attack will not dilute India's development assistance and its contribution to rehabilitation and reconstruction of Afghanistan," he said.
The spokesman added that the attack "stems from beyond" the Afghan borders -- in a pointer to possible elements in Pakistan who previously too have been behind the attacks on Indian missions in Afghanistan.
"All of us strongly condemn the attack in the strongest possible terms. The government was examining the reason and timing behind the attack," Akbaruddin added.
"We are assessing these events carefully and evaluating them, I won't jump to conclusions."
In the morning, Modi spoke with Indian Ambassador Amar Sinha, which "bolstered the morale of the Indian staff there".
Indian Foreign Secretary Sujatha Singh is monitoring the situation and is in touch with her counterpart in Afghanistan, Akbaruddin said Friday morning.
Shaida M. Abdali, the Afghan ambassador to India, speaking to Times Now TV channel described it as a terror attack, though he did not refer to the Taliban.
Asked if the Taliban were behind the attack, Abdali said: "There is no doubt that it is a terror attack, an attack on the friendship of India and Afghanistan... This attack can only embolden our determination that we will keep this friendship at all costs."
An ITBP official told IANS in New Delhi: "One of the attackers was killed at the entry point only, while three others managed to flee and enter the adjoining building."
"But in the meantime, Afghan forces joined the operation and gunned down the other three attackers," the official added.
Outgoing Prime Minister Manmohan Singh Friday condemned the attack and said this would not undermine the close ties between New Delhi and Kabul.
"I condemn in the strongest terms the attack on the consulate general of India... We are greatly relieved that all staff and security personnel at the consulate are safe," Manmohan Singh said.
"These attacks will neither succeed in undermining the close relations between India and Afghanistan nor deter India from fulfilling its commitment to help the Afghan people in building a peaceful, stable, united, democratic and prosperous Afghanistan."
"India will continue to support Afghanistan in its brave fight against terrorism," he added.
Manmohan Singh expressed gratitude to the Afghan and Indian security personnel at the consulate for battling the attackers.
Karzai also spoke to Manmohan Singh and reassured him of the safety of Indian missions there.
The attack in Herat has surprised many as the city, which lies near Afghanistan's border with Iran, is considered one of the safest in the country.
India is a major contributor to reconstruction and rehabilitation efforts in Afghanistan, and has invested more than $2 billion in Afghan projects, including roads and power projects, a dam and also the Afghan parliament building.
The last terror attack targeted the Indian consulate in Jalalabad near the border with Pakistan in August 2013, in which nine people, including six children, were killed. No Indian official was injured.
Two attacks on the Indian embassy in Kabul in 2008 and 2009 had killed a total 75 people.