CHARSADDA, Pakistan — Taliban gunmen stormed a university in northwestern Pakistan on Wednesday, killing at least 19 people and triggering a heavy gunbattle with police and army troops who rushed to the scene in a town near the city of Peshawar, officials said.

The brazen assault harked back to a December 2014 Taliban attack on a school in Peshawar that killed more than 150 people, mostly children, and shocked the nation.

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 in two university blocks and the Pakistani army said four of them have been killed.

A chemistry professor and a student were among those killed, said Zafar, adding that it was not clear how many attackers were inside 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 was quoted on the website of the Daily Pakistan as saying in a statement.

advertisement | advertise on newsday

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.

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.

@Newsday

The 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.