Militants in Indian-administered Kashmir are surrounded by the security forces after attacking Indian soldiers near Srinagar, military officials say.
At least two militants are now trapped inside a training institute. About 100 students and staff were evacuated from the building as it was encircled.
At least three soldiers and a civilian were killed in the earlier encounter, the military says.
Several troops were wounded and an armed stand-off in now under way.
Latest reports on Saturday night say that a fire fight between paramilitary forces and militants inside the institute has stopped and the security forces have cordoned off the area.
The security forces say they are preparing for a final assault on the institute.
Police told the AFP news agency that the militants were "suspected anti-India rebels" and had taken refuge inside the building, which houses the government-run Entrepreneurship Development Institute.
Before entering the institute, militants attacked paramilitary forces in a convoy on the main road linking Srinagar to Jammu, officials say.
Intermittent exchanges of fire near the building could still be heard until late on Saturday afternoon.
Eyewitnesses say as many as five gunmen could be holed up.
"All the civilians present inside the building have been evacuated," police Inspector General Javaid Gillani told AFP.
Witnesses say the gunmen told civilians in the complex to "save themselves" and move to a nearby hostel on the campus as they broke into the premises.
"They barged into the reception area as [paramilitary] soldiers were firing towards them," a witness told AFP. "They asked everyone to save themselves and go to the next building."
Kashmir, claimed by both India and Pakistan in its entirety, has been a flashpoint for more than 60 years.
The two South Asian rivals have fought two wars over the region in the Himalayas.