At least 20 people have been killed in an attack that lasted six hours at a university in northwest Pakistan, according to an army spokesperson.
Attackers scaled a wall and cut through barbed wire on Wednesday morning at the Bacha Khan University in Charsadda, about 140km from the capital Islamabad.
The attack left at least 50 people injured. A security official said the death toll could rise to as high as 40.
"The operation is over and the university has been cleared," Pakistan Army spokesperson General Asim Bajwa told Reuters news agency.
"Four gunmen have been killed."
Attackers entered the university complex in the Khyber-Pakhtunkhwa province of Pakistan and opened fire at students and teachers in classrooms and hostels, according to police officials.
There were conflicting statements from the Pakistani Taliban, as one commander claimed the attack, but the group's spokesperson later disassociated the Taliban from the attack, saying it was "un-Islamic".
Students told local media they saw several young men wielding AK-47 guns storming the university housing where many students were sleeping.
The university has over 3,000 enrolled students and was hosting an additional 600 visitors on Wednesday for a poetry recital on the death anniversary of the Pashtun activist Abdul Ghaffar "Bacha" Khan, the university's vice-chancellor said.
Abdul Ghaffar 'Bacha Khan' was known for his nonviolent protest opposing British rule over India.
|The death toll is likely to go up, according to a local journalist at the scene [Reuters]
"Around 200 students have been safely evacuated from an examination hall in the university," Provincial Public Health Engineering Minister Shah Farman said.
Local authorities have announced the closure of all education institutions across Charsadda until January 31.
Earlier, as police and soldiers rushed to the campus, the attackers traded gunfire with the troops and several explosions were heard from the area of the university.
The army said the attackers were contained in two university blocks before being killed.
Television footage showed heavy military presence at the university, troops rushing in and people fleeing.
|Charsadda, northwest Pakistan
Students spoke of one hero teacher, Syed Hamid Husain, fighting back against the intruders, shooting his weapon in a bid to protect the students.
Geology student Zahoor Ahmed said his lecturer had warned him not to leave the building after the first shots were fired.
"He was holding a pistol in his hand," said Ahmed.
"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."
Teachers in the province were given permission to carry firearms in the classroom after the December 2014 attack on the Army Public School in Peshawar.
On Tuesday, a suicide bomber blew himself up close to a police checkpoint in the Jamrud area of northwestern Pakistan, killing at least 10 people and wounding more than 20.
At least 144 people, most of them children, were killed when armed men attacked the 2014 attack on the Peshawar school.
Last month, Pakistan executed four men linked to the school massacre which left more than 130 school children dead.
The executions, which officials said were carried out by hanging at a prison in the city of Kohat, were the first in connection with the December 16 attack.
Source: Al Jazeera and agencies