At least 44 cadets and guards have been killed after militants attacked a police college in the Pakistani city of Quetta, officials say.
A major security operation lasted for hours after the attackers entered the building and opened fire.
The officials believe three militants wearing bomb vests stormed the college. All were killed.
Hundreds of trainees were evacuated from Balochistan Police College as troops arrived to repel the militants.
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, he said.
Many of the cadets were killed by the blasts, said Major General Sher Afgan of the Frontier Corps.
He blamed a faction of the Lashker-e-Jhangvi militant group and said the attackers "were in communication with operatives in Afghanistan".
No group has so far said it was behind the attack, which happened late on Monday.
Gunfire and explosions could be heard well after the attack was launched, witnesses said.
More than 100 people, mostly trainees, were injured.
"They were rushing toward our building firing shots so we rushed for safety toward the roof and jumped down in the back to save our lives," a police trainee told Geo television.
Earlier in the day, two customs officers were shot dead and another critically wounded in Surab, south of Quetta.
Quetta is the provincial capital of Balochistan, where separatist groups and Islamist militants have both carried out similar attacks in the past.
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.