CHARSADDA, Pakistan -- Taliban gunmen stormed a university in northwestern Pakistan on Wednesday, killing at least 20 people and triggering an hours-long gunbattle with the army and police before the military declared that the assault in a town near the city of Peshawar was over.
The attack stirred grim echoes of the horrific 2014 Peshawar school attack that killed more than 150 people, mostly children, and shocked the nation. It also prompted the Pakistani prime minister to pledge the country will wipe out the 'menace of terrorism.' Police said four attackers were also killed.
Wednesday's attack began shortly after the Bacha Khan University opened for classes in the town of Charsadda, some 35 kilometers (21 miles) outside Peshawar, said Deputy Commissioner Tahir Zafar.
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 attackers were later contained inside two university blocks where the troops killed four attackers, the army said.
A chemistry professor and a student were among those killed, said Zafar, adding that it was not initially clear how many attackers managed to penetrate the campus. Television footage showed heavy military presence at the university, troops rushing in and people fleeing. Ambulances were at the scene and the wounded were taken to hospital.
The attackers entered the university compound by climbing over back walls and shooting at a security guard before they made their way to the administration building and the male students' dorms, police official Saeed Khan Wazir said.
A witness, botany teacher Mohammad Ishtiaq, said he jumped out from the second floor of the building when he heard gunshots and broke his leg. Two attackers were on first floor and three on the ground floor, he said, adding that they were using automatic assault rifles. The students ran in different directions, he said.
"I locked myself in a washroom," he said. "I jumped out when I saw one of the attackers coming toward me and shooting straight ahead of him."
Pakistani Prime Minister Nawaz Sharif vowed to fight to the end and destroy the Taliban and other militants.
"We are determined and resolved in our commitment to wipe out the menace of terrorism from our homeland," Sharif said in a statement.
A Taliban leader, Khalifa Umar Mansoor, claimed responsibility for Wednesday's attack in a phone call to The Associated Press from an undisclosed location.
Mansoor, who was the mastermind mind the Peshawar school attack, said a four-man Taliban team carried out the assault in Chasadda. He said it was in revenge for the scores of militants the Pakistani security forces have killed in recent months. The main spokesman for the Pakistani Taliban, Mohammad Khurasani, also reiterated the claim of responsibility.
Wednesday's attack was also the second Taliban attack in as many days in the volatile northwest. A suicide bomber riding a motorcycle struck a crowded police checkpoint on the outskirts of Peshawar on Tuesday, killing 11 people in an attack that was also claimed by the Taliban.
Later on Wednesday afternoon, provincial governor Sardar Mehtab Abbasi declared that the military operation on the campus grounds had been completed and that the attack was over. The troops were combing the nearby areas, searching for more possible attackers, he said.
Pakistani army chief Gen. Raheel Sharif visited the campus and a town hospital where the wounded were brought to.
The Bacha Khan University is named after the founder of a liberal, anti-Taliban political party. The Pakistani Taliban have in the past targeted the party for its anti-militant policies.
Pakistan's northwest and its lawless tribal regions bordering Afghanistan is a highly volatile region. Pakistani forces have been carrying out a major operation against the Taliban and other militants there since 2014.
Last month, as the country marked the first anniversary of the Peshawar school attack, the military claimed "phenomenal successes" in the war and said it has killed around 3,500 insurgents since launching the operation.
Though authorities say overall violence has declined since the wide-ranging military offensive was launched in North Waziristan, the Taliban still manage to carry out major attacks.
The Peshawar school attack horrified the country and led the government to lift a 2008 moratorium on the death penalty. Pakistan hanged four militants last month who were sentenced to death over the attack.