Modi, who is here ahead of his swearing-in on Monday, said he spoke to Indian Ambassador in Afghanistan Amar Sinha following the attack this morning.
"I condemn the attack on our consulate in Herat, Afghanistan. Closely monitoring the situation. I have spoken to the Ambassador as well," he tweeted.
Gunmen armed with heavy weapons including rocket propelled grenades launched a pre-dawn assault on the consulate during which three attackers were killed. All the diplomatic staff were safe.
Indian Ambassador to Afghanistan Amar Sinha said three gunmen were killed, one by ITBP (Indo-Tibetan Border Police) and two by Afghan police, out of four attackers who struck the consulate which houses two buildings.
He said there were nine Indians in the mission apart from local Afghans.