Security forces have ended a gun and bomb attack on a university in north-west Pakistan in which 19 people were killed and 17 injured.
Four suspected attackers also died in a battle that lasted nearly three hours at Bacha Khan University in Charsadda.
One Pakistani Taliban commander said the group had carried out the assault, but its main spokesman denied this.
The group killed 130 students at a school in the city of Peshawar, 50km (30 miles) from Charsadda, in 2014.
Prime Minister Nawaz Sharif said in a statement: "We are determined and resolved in our commitment to wipe out the menace of terrorism from our homeland."
'Teacher shot back'
The attackers struck at about 09:30 local time (04:30 GMT), apparently climbing over a back wall under cover of the thick winter fog.
Intense gunfire and explosions were heard as security guards fought the attackers.
Students and staff ran to find cover in toilets and examination halls.
One student told television reporters he was in class when he heard gunshots: "We saw three terrorists shouting, 'God is great!' and rushing towards the stairs of our department.
"One student jumped out of the classroom through the window. We never saw him get up."
Reports say a chemistry lecturer, named by media as Syed Hamid Husain, shot back at the gunmen to allow his students to flee, before he was killed.
Geology student Zahoor Ahmed said the teacher had warned him not to leave the building after the first shots were fired.
"He was holding a pistol in his hand," he was quoted by AFP news agency as saying.
"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."
The victims - mostly male students - were shot in the head or chest. Seventeen people were injured. At least one security guard also died.
It could have been much worse - M Ilyas Khan, BBC News, Islamabad
There have been conflicting claims about who could be involved in the attack, a sign of the kaleidoscopic mix of militant networks evolving along the Pakistan-Afghan border region in the north.
The attack comes amid a sudden spike in militant violence in Pakistan, after a year of relative peace and quiet largely attributed to a 2014 military operation against militant sanctuaries in Waziristan. Questions are now being raised over whether that operation really destroyed the ability of militants to regroup and strike at will.
The attack is reminiscent of the December 2014 attack on a school in Peshawar in which more than 150 people, mostly schoolboys, were killed. But damage to life and property this time has been much less, mainly due to swift action by the local police, but also because of the fact that the university had its own team of more than 50 trained security guards on duty who first confronted the attackers.
A dense fog that reduced visibility to less than 10m may also have been a factor, as one police officer explained, because it put the attackers at a disadvantage against the university guards who knew the premises better.
Images from inside the university show a pool of blood on the floor of a dormitory and the bodies of two alleged militants lying on a staircase.
A senior Taliban commander, Umar Mansoor, told the media the attack was in response to a military offensive against militant strongholds. He said four suicide attackers had carried out the attack.
However, the group's main spokesman, Mohammad Khurasani, later told the BBC the Taliban had not been involved. He condemned the attack as "un-Islamic".
About 3,000 students are enrolled at Bacha Khan, but hundreds of visitors were also expected on Wednesday for a poetry event.
There is a symbolic value attached to Bacha Khan University as it is named after a Pashtun nationalist leader who believed in non-violent struggle, says BBC Urdu's Asad Ali Chaudry.
The title of Wednesday's poetry programme in his honour was "peace", he adds.
Just days ago, some schools in Peshawar were closed by the authorities amid reports that militants were planning an attack.
Deadliest recent attacks in Pakistan
- 20 January 2016: Militants kill at least 19 people in attack on Bacha Khan University in Charsadda, near Peshawar
- 13 December 2015: Bomb blast kills 24 people at a clothes market in the Kurram tribal region
- 18 September 2015: Taliban militants kill 29 people in an attack on an air force base in Peshawar
- 13 May 2015: Gun attack on a bus carrying Ismaili Shia Muslims in Karachi leaves at least 45 people dead
- 13 February 2015: Militants attack a Shia mosque in Peshawar with guns and grenades; at least 20 people killed
- 30 January 2015: Bomb blast at a Shia Mosque in Shikarpur district, Sindh province, kills at least 40 people