Updated January 20 at 10:54 a.m. EST

At least 20 people were killed and more were injured when armed gunmen stormed a university in northwestern Pakistan on Wednesday.

The hours-long attack at Bacha Khan University in Charsadda began shortly after the school opened, the Associated Press reported, citing local police officials.

The Associated Press of Pakistan, Pakistan’s government-run news agency, said the victims were mostly students. At least 19 people were wounded, The New York Times reported, citing a police official. The Times puts the number of people killed at 22.

Four assailants were killed in a shootout with army and police officers. Snipers killed two more attackers stationed on a rooftop, said Lieutenant General Asim Salim, director general of ISPR, the media department of Pakistan’s military, in a tweet.

A Taliban leader has claimed responsibility for the attack, according to news reports. But Muhammad Khurasani, a spokesman for the Pakistani Taliban, condemned the attack and called it “anti-Sharia,” or anti-Islam.

AP reports the attackers scaled walls at the rear of the university and shot a security guard before they approached the school’s administration building and student dorms. One account, from the AP:

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 Muhammad Nawaz Sharif, who is in Zurich for the World Economic Forum, promised a “ruthless response” to the attack.

“We are determined and resolved in our commitment to wipe out the menace of terrorism from our homeland,” he said in a statement.

The prime minister declared a day of national mourning, according to the Associated Press of Pakistan. Flags were flown at half-staff at government buildings.

The site of the assault was about 20 miles from a school in Peshawar where the Pakistani Taliban killed 145 people, mostly children, in December 2014. In 2012, the group shot Malala Yousafzai, the teenage activist for girls’ rights who was awarded the Nobel Peace Prize two years later.

Pakistan’s government-run news agency said Bacha Khan University had gathered for a mushaira, a poetry event, to commemorate the anniversary of the death of Khan Abdul Ghaffar Khan, nicknamed Bacha Khan, a Pashtun activist who led a nonviolent movement for independence from the British in the late 1920s. The university is named for him.