Taliban gunmen stormed a Pakistani air force base early on Friday, killing at least 17 people, most of whom were offering prayers in a mosque, a military spokesman said, the deadliest such attack in years.
The assault shows the Taliban retain the capability to mount devastating attacks despite a military campaign and tougher government measures against them following the massacre of more than 150 people at an army-run school last December.
Sixteen of Friday's victims were at morning prayers, and a captain died leading the counter-attack against the raiders, 13 of whom were killed, Major General Asim Bajwa said on Twitter.
Bajwa did not say if those killed in the mosque at the Badaber air base, about 10 km (6 miles) south of the centre of the northwestern city of Peshawar, were civilians or military.
"Terrorists entered camp at two points. Encounter began immediately," Bajwa tweeted. The attackers "were contained within a close area. Meanwhile a group rushed to mosque, martyred 16 offering prayers."
He posted pictures of some of the attackers' bloodied bodies in the uniform of the paramilitary Frontier Constabulary, black traditional Pakistani clothes known as shalwar khameez.
The attack took worshippers by surprise, said Mohammad Ikram of the Pakistani Air Force, who was in the mosque at the time.
"We were offering prayers when we first heard the gunshots and then, within no time, they entered the mosque where they began indiscriminately firing," he said by telephone from a hospital bed where he was being treated for gunshot wounds.
"They killed and injured most of the worshippers. I fell on the ground. Then the gunmen went to other places in the base. After a long time, we were shifted to the hospital."
A senior Pakistani military official said most of those in the mosque when it was attacked were working with the air force.
"All the terrorists were wearing explosives-laden jackets and were armed with hand-propelled grenades, mortars and AK-47 rifles," a military official at the base, who asked not to be identified, told Reuters.
Military officials were combing villages near the base for any remaining militants, he added.
"We proudly claim responsibility for the attack on Pakistani air base," Taliban spokesman Muhammad Khorasani told Reuters, adding that 14 militants had been dispatched to the base. "This base is being used by fighter jets for bombing us."
Attacks by the Taliban have fallen about 70 percent this year, following a military offensive against the militants' bases along the Afghan border and the government's redoubled efforts to combat them.
Despite the reduction in attacks, the militants still manage to strike high-value targets. The home minister of Punjab province was among 16 killed in a suicide attack last month.
In a separate incident in northwest Pakistan, eight civilians were killed in a military strike in South Waziristan early on Friday, a survivor told Reuters.
"The house next to my house was completely destroyed," said Naimat Ullah, whose son was injured by flying shrapnel.
Neighbours who excavated the bodies had told him three young girls, three men and two women died in the strike, he added.