At least 21 people died when gunmen attacked a university in Pakistan Wednesday, where witnesses reported two large explosions as security forces moved in under dense fog to halt the bloodshed.
The assault was initally claimed by a Taliban faction, but later branded "un-Islamic" by the group's leadership in Pakistan, who vowed to hunt down those responsible.
The number of dead climbed rapidly after armed men stormed the Bacha Khan university in Charsadda, about 50 kilometres (30 miles) from the city of Peshawar, in the latest outrage to hit the militant-infested region.
Police, soldiers and special forces swarmed the university from the ground and the air in a bid to shut down the assault, as television images showed female students running for their lives.
"The death toll in the terrorist attack has risen to 21," regional police chief Saeed Wazir told AFP hours after the alarm was first raised.
He said the operation had ended and security forces were clearing the area, with most of the student victims shot dead at a hostel for male students.
"More than 30 others including students, staff and security guards were wounded," he added.
He said the attackers had "taken advantage of the fog", adding that university authorities had estimated visibility at less than 10 metres (30 feet) at the time.
Military spokesman Major General Asim Bajwa said four attackers had been killed, two by snipers. It was not immediately clear if the four were included in the toll of 21 given by police chief Wazir.
Umar Mansoor, a commander of the Hakimullah Mehsud faction of the Tehreek-e-Taliban Pakistani (TTP), claimed responsibility for the attack.
"Our four suicide attackers carried out the attack on Bacha Khan University today," said Mansoor, who security forces believe was the mastermind behind a similar attack on an army-run school in nearby Peshawar in 2014 that left more than 150 people dead.
However the TTP's central leadership denied any involvement in Wednesday's assault, with a spokesman branding it "un-Islamic".
"TTP strongly condems today's attack and disassociates itself completely from this un-Islamic attack," spokesman Muhammad Khurasani said on Twitter, vowing that the group would bring those behind the assault to justice.
The apparent dispute appears to be a sign of continued infighting in the Pakistani Taliban, as the Islamic State group seeks to gain a foothold in the region by recruiting disaffected fighters.
- Teacher fighting back -
Students spoke of one hero teacher, Syed Hamid Husain, fighting back against the intruders, shooting his weapon in a bid to protect his charges.
Geology student Zahoor Ahmed said his chemistry lecturer had warned him not to leave the building after the first shots were fired.
"He was holding a pistol in his hand," he said.
"Then I saw a bullet hit him. I saw two militants were firing. I ran inside and then managed to flee by jumping over the back wall."
Another student told television reporters he was in class when he heard gunshots.
"We saw three terrorists shouting, 'Allah is great!' and rushing towards the stairs of our department," he said.
"One student jumped out of the classroom through the window. We never saw him get up."
He also described seeing the chemistry professor holding a pistol and firing at the attackers.
"Then we saw him fall down and as the terrorists entered the (registrar) office we ran away."
Pakistan's President Mamnoon Hussain confirmed the lecturer had died.
An emergency services spokesman suggested that other students and teachers had also fired at the attackers, adding that Husain was among them.
"That is why the attackers could not succeed much," Bilal Faizi told AFP.
- Security 'beefed up' -
"There was no announced threat but we had already beefed up security at the university," university vice chancellor Fazal Raheem Marwat said earlier Wednesday.
India "strongly condemned" the attack, with leader Narendra Modi tweeting his condolences and prayers for the victims.
Wednesday's attack had chilling echoes to the Taliban assault on the Army Public School in Peshawar in December 2014, Pakistan's deadliest ever attack, in which the majority of the victims children.
After a public outcry, the military intensified an offensive in the tribal areas where extremists had previously operated with impunity and the government launched a crackdown.
Mansoor, the alleged mastermind behind the attack who also claimed Wednesday's assault, vowed in 2014 to continue attacks in response to the military crackdown.
"If you attack us we will take revenge for the innocents," he said in a video message posted online at the time.