At least 58 cadets and guards have been killed after militants attacked a police college in the Pakistani city of Quetta, officials say.
Three militants wearing suicide bomb vests entered the college late on Monday, reportedly taking hostages.
A major security operation lasted for hours and all attackers were killed.
No group has said they carried out the assault, but Quetta has seen similar attacks by separatists and Islamist militants in recent years.
Hundreds of trainees were evacuated from Balochistan Police College as troops arrived to repel the militants. Local media reported at least three explosions at the scene.
"I saw three men in camouflage whose faces were hidden carrying Kalashnikovs," one cadet said according to AFP news agency. "They started firing and entered the dormitory but I managed to escape over a wall."
The police academy is home to about 600 students and many of the cadets who died were killed in the blasts, said Major General Sher Afgan of the Frontier Corps.
The exact sequence of events is unclear but there was intermittent exchange of fire between the attackers and security forces for several hours, according to Dawn newspaper. There were also reports of a hostage situation.
More than 100 people, mostly trainees, were injured.
Pakistan's army and the paramilitary Frontier Corps took part in the military counter-operation, which Balochistan provincial home minister Mir Sarfaraz Ahmed Bugti said was now over.
Two of the militants died after detonating their bomb vests and one was killed by security forces.
Officials blamed a faction of the Lashker-e-Jhangvi militant group and said the attackers "were in communication with operatives in Afghanistan".
Quetta is the capital of Balochistan province, which is battling an insurgency as well as Islamist militants, with violent attacks common.
Earlier in the day, two customs officers were shot dead and another critically wounded in Surab, south of Quetta.
In August, 88 people were killed in separate bomb attacks targeting a hospital and lawyers in Quetta.
The Pakistani military has been conducting military operations against militants in volatile tribal areas near the Afghan border.