Gunmen broke into a university campus in northwestern Pakistan on Wednesday morning, fatally shooting students in their dorm rooms in an assault that left at least 21 people dead, police and hospital officials said.
A commander of the Pakistani Taliban, which has frequently attacked educational institutions in a long insurgency against the government, claimed responsibility for the attack.
A Pakistani army spokesman said four militants were shot and killed by army soldiers at Bacha Khan University in Charsadda, east of the city of Peshawar.
It was one of the most brazen attacks claimed by the Pakistani Taliban, and came barely one year after the militant group raided an army-run public school in Peshawar, massacring more than 150 people, most of them children.
Officials and witnesses said the assailants took advantage of a thick wintry fog that had blanketed the campus, impairing visibility.
They scaled a wall at the rear entrance to the campus around 9 a.m. after cutting a coil of barbed wire, and rushed toward a nearby dormitory for male students, lobbing hand grenades into the rooms, authorities said.
Shahzad Khan, a security guard, said he opened fire at the assailants but ran out of ammunition.
Witnesses said one professor and at least two female students were among the dead, along with campus security guards.
Abdul Majeed, a photojournalist who visited the scene, said the bodies of students lay in the dorm rooms. The four attackers were shot and killed inside the dormitory, he said.
Doctors said 19 bodies and 14 injured people reached a government hospital in Charsadda, while rescue teams raced from Peshawar, about 20 miles away, and other nearby cities. Officials feared the death toll would rise because many others were injured, some seriously.
Students said the attackers opened fire indiscriminately. "There was a thick fog and I heard gunfire," said Zakir Ali, a student who suffered a bullet injury.
Faiz Muhammad, a resident, said that firing continued for at least four hours and that army troops besieged the campus, with helicopters circling overhead.
"I heard at least eight loud blasts inside the campus," Muhammad said.
Pakistan's chief of army staff, Gen. Raheel Sharif, visited the university after soldiers from the elite Special Services Group had cleared the campus. Sharif was "grieved over [the] tragic loss," according to a statement from the military spokesman, Asim Bajwa.
Prime Minister Nawaz Sharif said in a statement that the government was "determined and resolved in our commitment to wipe out the menace of terrorism from our homeland."
A Pakistani Taliban commander, Umar Mansoor Narrray, told reporters by telephone that four attackers had been sent to the university in retaliation for a Pakistani military offensive that has targeted the group since mid-2014. But later, the Pakistani Taliban's chief spokesman denied the group was behind the incident.
The Pakistani army says the operation, dubbed Zarb-e-Azb, has killed hundreds of militants in the North Waziristan tribal region. But analysts say many fighters have moved to cities or across the border into Afghanistan, and the insurgent group has continued to carry out attacks.
Pakistani intelligence agencies had issued a security alert Jan. 3, citing information that at least eight suicide bombers had entered the province of Khyber Pakhtunkhwa from Afghanistan and could try to target educational institutions.
Since the December 2014 massacre at the army-run school, Pakistan announced a host of measures that officials said would fight terrorism, including lifting a moratorium on the death penalty. Human rights groups say more than 330 death row convicts have been executed since December 2014, although many of them were not found guilty in terrorism cases.
As militant violence has risen in Pakistan over the last decade, educational institutions have been particularly vulnerable. Since the 1970s, more people have died in attacks on schools in Pakistan than in any other country, according to the University of Maryland's Global Terrorism Database.
In 2012, Pakistani Taliban gunmen shot Malala Yousafzai, the girls education activist who later won the Nobel Peace Prize.
Wednesday's attack came on the anniversary of the death of the university's namesake, Abdul Ghaffar Khan, also known as Bacha Khan, a pacifist who led nonviolent campaigns against British colonial rule.
Ali is a special correspondent. Staff writer Bengali reported from Dhaka, Bangladesh.