At least 19 people were killed and 50 injured in a gun and bomb attack on Bacha Khan University in Charsadda, north-west Pakistan.
Four suspected attackers were killed in a battle that lasted nearly three hours.
Security forces continued to secure the campus, checking classrooms and dormitories, amid fears more bodies would be found.
There are conflicting reports about whether the Taliban militants carried out the assault
The group killed 130 students at a school in the city of Peshawar, 30 miles from Charsadda, in 2014.
Pakistani PM Nawaz Sharif said in a statement, quoted by Reuters news agency: “We are determined and resolved in our commitment to wipe out the menace of terrorism from our homeland.”
Attackers struck at around 09:30 local time, reportedly 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.
Images from inside the university show a pool of blood on the floor of a dormitory and the charred corpses of two alleged militants lying on a staircase.
Nineteen bodies were taken to a local mortuary. It was not immediately clear if the attackers were among them.
A senior Taliban commander, Umar Mansoor, told media that the attack was in response to a military offensive against militant strongholds. He said four suicide attackers had carried out the attack.
The university is located in an open area some distance east of Charsadda town, surrounded by open agricultural fields.
Bacha Khan is a new university, founded in 2012, its website says.
Just days ago, some schools in Peshawar were closed by the authorities amid reports that militants were planning an attack.