Updated

The Islamic State terror group claimed responsibility Tuesday for a massacre at a police training center in southwestern Pakistan that left 61 dead -- but a breakaway faction of the Pakistani Taliban claimed its fighters launched the attack.

Pakistani officials feared the death toll could rise further, as the four-hours-long siege -- one of the deadliest attacks on Pakistan's security forces in recent years -- left 123 wounded, some of them in critical condition.

ISIS UNLEASHES 'HEAVY RESISTANCE' OUTSIDE MOSUL, PENTAGON REPORTS

Most of the dead were police cadets and recruits. The initial attack led to a ferocious gunbattle with troops that lasted from Monday night into the early hours Tuesday.

The assault caught many of the recruits asleep in their dorms and forced cadets and trainers to jump off rooftops and run for their lives to escape the attackers.

ISIS, which is waging war in Syria and Iraq where it has declared a self-styled caliphate, posted a claim on the group's media arm, the Arabic-language Aamaq news agency. It said three ISIS fighters killed 60 police recruits in Quetta but the claim was not confirmed by Pakistani officials and ISIS did not offer any previously unknown details about the assault.

Earlier, a little-known breakaway faction of the Pakistani Taliban, known as the Hakimullah group, also issued a statement claiming responsibility for the attack. Pakistani officials, doubting the group's capabilities in staging such a coordinated and spectacular assault, also could not confirm that claim.

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.

YAZIDIS GUARD RAVAGED HOME, EVER WARY OF ISIS' CHEMICAL ATTACKS

The attack in Quetta began at 11:30 p.m. 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.

Baluchistan officials had earlier received "intelligence reports that some terrorists have entered the province" but had no indications about possible targets.

"We had tightened security, which is why they could not do it in the city and chose a target on the outskirts," said Baluchistan's chief minister, Sanaullah Zehri.

There were also disparate figures as to the number of attackers. Provincial police chief Ahsan Mahboob said four gunmen were involved in the assault while a military statement later said there were up to six attackers.

About 700 cadets, trainees, instructors and other staff were inside the academy when it was attacked, Bugti said, adding that the gunbattle 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 shot 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 fires set off by the explosions from the attackers' suicide vests.

Most of those being treated at the city hospitals had gunshot wounds, although some sustained injuries 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."

Maj. Gen. Sher Afgan, head of the Pakistani paramilitary force which is primarily responsible for the province, claimed the attackers had received instructions from commanders in neighboring 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 Islamic State and the Hakimullah group's claims 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, Ghani also condemned the attack, saying that "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, Ghani has been deeply critical of Pakistan, saying it has provided safe havens to the Taliban and in particular the violent Haqqani network.

For over 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 military 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.

Later Tuesday, a roadside bomb killed a police official escorting a polio team that was travelling in northwestern Pakistan as part of a vaccination campaign, according to Furqan Bilal, a police superintendent in Peshawar.  Militant attacks on polio teams are common in Pakistan as Taliban and other extremists denounce such vaccination campaigns as a Western conspiracy.

The Associated Press contributed to this report.