A three-day-long standoff between security forces and fighters in Indian-administered Kashmir ended with a firefight that left all the attackers dead.
The assault on the training insitute in the town of Pampore on Monday left two fighters dead, with another killed a day earlier.
The clashes began on Saturday when three gunmen opened fire on a bus carrying police officers, and then captured the five-storey state building.
Three soldiers, two policemen and a civilian died in the fighting, and more than 100 people were inside the training institute when it was taken over by the gunmen.
More than a dozen soldiers were injured in the attack, the DPA news agency reported.
Broadcaster NDTV reported that the forces had cornered the gunmen in one part of the building before launching the final assault.
TV footage showed security forces firing mortar shells and rockets on the building.
The Times of India newspaper, citing security officers, said the attackers were foreign members of the Pakistan-based Lashkar-e-Taiba.
The attack comes shortly after a raid by separatist fighters on an Indian air base that stalled bilateral talks between neighbouring India and Pakistan.
Kashmir is divided into two parts, separately administered by India and Pakistan. The countries have fought two wars over the region and more than 45,000 people have been killed since a secessionist movement took hold in the 1980s.
India has repeatedly accused Pakistan of aiding Kashmiri separatist groups.
Source: Al Jazeera and Agencies