Middle East-based Islamic State (IS) militants on Tuesday said fighters loyal to their movement attacked a police training college in the southwestern Pakistani city of Quetta, in a raid that officials said killed 59 people and wounded more than 100.
Pakistani authorities have blamed another militant group, Lashkar-e-Jhangvi (LeJ), for the late-night siege, though the IS claim included photographs of three alleged attackers.
Hundreds of trainees were stationed at the facility when masked gunmen stormed the college on the outskirts of Quetta late on Monday. Some cadets were taken hostage during the raid, which lasted nearly five hours. Most of the dead were cadets.
"Militants came directly into our barrack. They just barged in and started firing point-blank. We started screaming and running around in the barrack," one police cadet who survived told media.
Other cadets spoke of jumping out of windows and cowering under beds as masked gunmen hunted them down. Video footage from inside one of the barracks showed blackened walls and rows of charred beds.
IS's Amaq news agency published the claim of responsibility, saying three IS fighters "used machine guns and grenades, then blew up their explosive vests in the crowd".
Mir Sarfaraz Bugti, home minister of the province of Baluchistan, whose capital is Quetta, said the gunmen attacked a dormitory in the training facility, while cadets rested and slept.
"Two attackers blew up themselves, while a third one was shot in the head by security men," Bugti said. Earlier, officials had said there were five to six gunmen.
A Reuters photographer at the scene said authorities carried out the body of a teenaged boy who they said was one of the attackers and had been shot dead by security forces.
Prime Minister Nawaz Sharif and Army chief General Raheel Sharif both traveled to Quetta after the attack and participated in a special security meeting on Tuesday afternoon, the prime minister's office said.
One of the top military commanders in Baluchistan, General Sher Afgun, told media that calls intercepted between the attackers and their handlers suggested they were from the sectarian Sunni militant group, Lashkar-e-Jhangvi (LeJ).
"We came to know from the communication intercepts that there were three militants who were getting instructions from Afghanistan," Afgun told media, adding that the Al Alami faction of LeJ was behind the attack.
LeJ, whose roots are in the heartland Punjab province, has a history of carrying out sectarian attacks in Baluchistan, particularly against the minority Hazara Shias. Pakistan has previously accused LeJ of colluding with al Qaeda.
Authorities launched a crackdown against LeJ last year, particularly in Punjab province. In a major blow to the organization, Malik Ishaq, the group's leader, was killed in July 2015 alongside 13 members of the central leadership in what police say was a failed escape attempt.
"Two, three days ago we had intelligence reports of a possible attack in Quetta city, that is why security was beefed up in Quetta, but they struck at the police training college," Sanaullah Zehri, chief minister of Baluchistan, told the Geo TV channel.
The Hakeemullah Mehsud faction of the Pakistani Taliban also claimed responsibility for the attack in an emailed statement, but when members of the group were asked about the statement, they could not confirm it was authentic.
Pakistan has improved its security situation in recent years but Islamist groups continue to pose a threat and stage major attacks in the mainly Muslim nation of 190 million.
IS has sought to make inroads over the past year, hoping to exploit the country's growing sectarian divisions.
Monday night's assault on the police college was the deadliest in Pakistan since a suicide bomber killed 70 people in an attack on mourners gathered at a hospital in Quetta in August.
The August attack was claimed by IS, but also by a Pakistani Taliban faction, Jamaat-ur-Ahrar.
The military had dismissed previous IS claims of responsibility and last month said it had crushed the Middle East-based group's attempt to expand in Pakistan. It also dismissed previous IS claims of responsibility as 'propaganda'.
A photograph of the three alleged attackers released by IS showed one individual with a striking resemblance to the picture of a dead gunman taken by a policeman inside the college, and shared with Reuters.
Analysts say IS clearly has a presence in Pakistan and there is growing evidence that some local groups are working with IS.
"The problem with this government is that it seems to be in a complete state of denial," said Zahid Hussain, an Islamabad-based security analyst.
Wounded cadets spoke of scurrying for cover after being woken by the sound of bullets.
"I was asleep, my friends were there as well, and we took cover under the beds," one unidentified cadet told Geo TV. "My friends were shot, but I only received a (small) wound on my head."
Another cadet said he did not have ammunition to fight back.
Officals said the attackers targeted the center's hostel, where around 200 to 250 police recruits were resting. At least three explosions were reported at the scene by media.
Quetta has long been regarded as a base for the Afghan Taliban, whose leadership has regularly held meetings there.
Baluchistan is no stranger to violence, with separatist fighters launching regular attacks on security forces for nearly a decade and the military striking back.
Militants, particularly sectarian groups, have also launched a campaign of suicide bombings and assassinations of minority Shias.
Attacks are becoming rarer but security forces need to be more alert, Interior Minister Nisar Ali Khan warned.
"Our problem is that when an attack happens, we are alert for a week after, ten days later, until 20 days pass, (but) then it goes back to business as usual," he said.
"We need to be alert all the time."