Militants wearing suicide vests stormed a Pakistani police academy in the south-western city of Quetta overnight, killing at least 59 people, mostly police cadets and recruits, and waging a ferocious gun battle with troops that lasted into the early hours of Tuesday.
Pakistani officials feared the death toll could rise further, as the four-hour siege - one of the deadliest attacks on Pakistan's security forces in recent years - left 117 other people injured, some of them in a critical condition.
The attack caught many of the recruits asleep in their dorms and forced cadets and trainers to jump off rooftops and run for their lives.
While most of the casualties were police cadets and others at the academy, some of the army personnel who responded to the assault were also among those killed, said Shahzada Farhat, police spokesman in Quetta, the capital of Baluchistan province.
By mid-morning on Tuesday, a little- known breakaway faction of the Pakistani Taliban, known as the Hakimullah group, issued a statement claiming responsibility for the attack.
But Pakistani authorities, doubting the group's capabilities in staging such a co-ordinated and spectacular assault, could not confirm the claim.
There were also unconfirmed reports the Islamic State group was going to issue its own claim on the extremists' Amaq website.
The attack began at 11.30pm local time on Monday, said Baluchistan Home Minister Sarfraz Bugti, with the militants shooting and killing a police guard at the watch tower before storming into the academy, located on the outskirts of Quetta.
Reports on the number of attackers varied. Provincial police chief Ahsan Mahboob said four gunmen were involved, while a military statement later said there were up to six.
About 700 cadets, trainees, instructors and other staff were inside the academy when it was attacked, Mr Bugti said, adding that the gun battle with the militants lasted for at least four hours.
Once inside the academy grounds, Pakistani media said the gunmen headed straight to the dorms housing the cadets and trainees and opened fire, shooting indiscriminately. Some of the cadets jumped off the rooftops and through windows to try to escape.
"They were rushing toward our building, firing," one cadet told Pakistani Geo TV news channel. "We rushed for safety toward the roof and jumped down in the back of the building."
Another recruit, his face covered in blood, told the station the gunmen fired at whoever they saw. "I ran away, just praying God might save me," he said.
After the attack, Pakistani forces tightened security around the academy and Quetta hospitals were the wounded were taken.
Footage aired on local television stations showed ambulances rushing out of the main entrance of the academy as fire engines struggled to put out blazes set off by the explosions from the attackers' suicide vests.
Most of those being treated at the city hospitals had gunshot wounds, although some suffered injuries after jumping off the rooftop of the hostel housing the cadets to escape the gunmen.
"This war isn't over," said Pakistani Interior Minister Chaudhry Nisar Ali Khan. "The enemy is weakened, but not eliminated."
Major General Sher Afgan, head of the Pakistani paramilitary force which is primarily responsible for the province, claimed the attackers had received instructions from commanders in neighbouring Afghanistan.
He said they were most likely from the banned Lashker-e-Jhangvi Al-Almi militant group affiliated with al Qaida and the Taliban. The Sunni militant group has mainly targeted minority Shiite Muslims whom its members consider to be infidels.
The paramilitary chief spoke before the Hakimullah group's claim surfaced.
Afghanistan condemned the attack and dismissed Pakistan's allegations that the assault was planned from bases inside Afghanistan.
"Afghanistan is the biggest victim of terrorism and denounces all terrorist attacks," said Mohammad Haroon Chakhansuri, spokesman for Afghan President Ashraf Ghani.
In a separate statement, Mr Ghani also condemned the attack, saying "terrorism is a threat throughout the region, which is reflected in the brutal act today in Quetta".
Pakistan maintains that militants fleeing army operations in the tribal regions regularly escape across the border, finding safe havens inside Afghanistan. For his part, Mr Ghani has been deeply critical of Pakistan, saying it has provided safe havens to the Taliban and in particular the violent Haqqani network.
For more than a decade, Baluchistan has been the scene of a low-intensity insurgency by nationalist and separatist groups demanding a bigger share in the regional resources. Islamic militants and Sunni sectarian also have a presence in the province.
Pakistan has carried out several operations against militants in country's lawless tribal regions along Afghanistan border, including a major push that started mid 2014 in North Waziristan, a militant base.
The Islamic militants have killed tens of thousands of people in their bid to overthrow Pakistan's government and install their own harsh brand of Islamic law.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules here