Clearing operations in Mazar-i-Sharif on by special forces, Indian Ambassador to Afghanistan Amar Sinha said.
"Heavy fighting going on," he said, adding that Balkh province's Governor Atta Muhammad Noor was personally monitoring the situation.
Mr Sinha, in a tweet, said all were safe in the consulate. Explosions and gunfire rang out last night as terrorists attempted to storm the Indian diplomatic mission in Mazar-i-Sharif.
Indian and Afghan security forces were jointly engaged in a gun-battle with at least two unidentified attackers, who attempted to strike the Indian consulate.
In all 4-5 attackers were believed to have launched the attack, sources said.
The sources said a contingent of Afghanistan security forces and India's Indo Tibetan Border Police Force (ITBP) were retaliating and combating intermittent gunfire that is emanating from a building near the consulate since last night and it is believed that at least 2-3 attackers are still active out of the total of 4-5 who attempted to storm the heavily guarded complex.
"Two attackers are believed to be killed after security forces engaged them," they said.
The operation to completely neutralise the attackers, who first hit at about 2115 hours IST yesterday, is still on and gunfire is being exchanged between the two sides even as Afghan forces are trying to get into the consulate building, the sources said.
"All the Indian staff is safe," they said. Officials said the gunmen yesterday tried to enter the consulate from its rear end and fired an RPG round which got mis-directed and hit a building called the Alamas wedding hall, about 100 metres from the Indian Consulate building.
At least 4-5 rocket rounds and numerous bullet rounds have been fired towards the Indian complex, they said, but none of them hit the building.
"A tight cordon has been created by the Afghan security forces on the outside and Indo-Tibetan Border Police personnel in the proximate circle of the consulate," the sources said.
The forces have been asked to ensure zero movement outside the consulate. No group claimed responsibility for the attack which came just a day after Pakistani terrorists attacked an IAF base in Pathankot in Punjab.
The attack also comes days after Prime Minister Narendra Modi was in Kabul on a brief visit on December 25 during which he inaugurated the new building for Afghan Parliament built by India at a cost of USD 90 million.