A two-member militant suicide squad on Thursday stormed the divisional headquarters of the Jammu and Kashmir government in Srinagar, which had 250 people inside.
The militants killed four people and injured two before being neutralized by the security forces after a three-and-a-half hour gun battle.
The Al Badr militant outfit has claimed responsibility for the attack.
Faheem, a spokesman of the outfit, told the local Kashmir News Service that the slain militants were Irfan and Sikander, both residents of Pakistan.
He said the outfit was also responsible for a grenade attack at Sopore in which 14 persons, including two Border Security Force personnel, were injured.
The ultras had taken refuge in one of the revenue offices in the complex, Deputy Inspector General of Police H K Lohia said.
Two Central Reserve Police Force personnel, a policeman and a woman government employee were killed, he said.
"Our priority was to evacuate the nearly 250 civilians, including employees and visitors to the offices, to safety. It took some time but we managed to evacuate all but one civilian," Lohia said.
Lohia, Deputy Commissioner Shailendra Kumar and dozens of officers were chalking out a strategy to provide relief to the avalanche-affected people of the Kashmir valley when the militants struck.
After evacuating the civilians in bulletproof vehicles, security forces managed to corner the militants and fired tear smoke shells to draw them out. The militants held their ground.
The forces then lobbed grenades inside the building, which neutralised the militants.
The relief operations suffered a setback as the police had to suspend all work and focus attention on flushing out the militants.
The complex is adjacent to several government installations, including the Legislative Assembly and the old secretariat.
More from rediff