Taliban gunmen killing at least nine people and wounding 35, local media reported.
The gunmen disguised in burqas stormed the campus of an agriculture university in Pakistan on Friday.
Police and army troops summoned to the scene killed all of the four attackers at the Directorate of Agriculture Institute in the northwestern city of Peshawar about two hours into the attack, the military's press wing said.
The number of wounded is expected to increase, local Dawn News reported.The Tehreek i Taliban Pakistan (TTP) claimed responsibility for the attack.
The gunmen arrived at the campus in an auto-rickshaw and disguised in the burqas worn by women in the region, Peshawar police chief Tahir Khan said.
They shot and wounded a guard before entering the campus, he said, adding that five wounded people had been taken to hospital.
Shehzad Akbar, medical director of Hayatabad Medical Complex, said six people died of their wounds and 18 were being treated. Another three people died at Khyber Teaching Hospital and 17 wounded were there, director Nekdad Afridi said.
A wounded student, Ahteshan ul Haq, said that the university hostel usually houses nearly 400 students, but most of them had gone home for a long holiday weekend and only about 120 students remained, reports Reuters.
"We were sleeping when we heard gunshots. I got up and within seconds everybody was running and shouting 'the Taliban have attacked'," he said.
In December 2014, Taliban gunmen killed 134 children at Peshawar's Army Public School, one of the single deadliest attacks in the country's history.