HERAT, Afghanistan - Four insurgent gunmen launched a pre-dawn attack on India's consulate in the western Afghan city of Herat on Friday before being repelled by security forces, in an assault highlighting instability as NATO troops withdraw.
There were no casualties among Indian staff but at least one policeman was wounded when the attackers stormed a house close to the consulate and opened fire on the building.
Afghanistan is in the middle of elections to choose a successor to President Hamid Karzai, who has ruled since the fall of the 1996-2001 Taliban regime.
Pakistan was the Taliban's main ally and the Pakistani security forces have often been accused of assisting the insurgents, especially with attacks on Indian targets in Afghanistan.
"Four Taliban attackers entered a residential house behind the consulate in the early morning," Mohammad Yousuf Pashtoon, commander of Herat's paramilitary Quick Reaction Force, told AFP.
"Security forces evacuated residents from the building and fought to clear the building."
The interior ministry said all the insurgents had been killed but sporadic gunfire continued at the scene.
India has been a key supporter of Kabul's post-Taliban government, and analysts have often pointed to the threat of a "proxy war" in Afghanistan between India and its arch-rival Pakistan.
The Pakistani government issued a swift condemnation of the attack, saying it was opposed to "terrorism in all its forms and manifestations".
The Taliban did not immediately claim responsibility for the attack, which came after incoming prime minister Narendra Modi invited Pakistan premier Nawaz Sharif to his inauguration in Delhi next week.
"One gunman was shot by the ITBP (Indo-Tibetan Border Police) while they were trying to breach the consulate," Indian foreign ministry spokesman Syed Akbaruddin told the news channel NDTV.
He added that Indian and Afghan security forces had been "successful in rebutting this attack".