Taliban militants have killed at least 29 people in an attack on an air force base in the northern city of Peshawar, Pakistani officials say.
The gunmen, dressed in police uniforms, stormed the Badaber air base on Friday morning, Maj Gen Asim Bajwa said.
At least 16 of the victims were killed during morning prayers at a mosque inside the compound, Gen Bajwa added.
The Pakistani Taliban said they ordered the attack. Peshawar has frequently been targeted by militants.
Gen Bajwa said the militants entered the base, which is 10km (6 miles) south of Peshawar, at two points and then split into groups.
A rapid response force was dispatched to the scene and contained the attackers around a guard room, he added.
Thirteen militants were said to have been killed by security forces, although the Taliban said just one of their fighters died.
The total number of gunmen involved is unclear, but Gen Bajwa said his forces were hunting for the remaining attackers.
The exchange of fire also left 29 people injured, the Pakistani military said.
Gen Bajwa claimed that mobile phone intercepts suggested that the attackers had come from inside Afghanistan, though he said there was no reason to blame the Kabul government.
Analysis: M Ilyas Khan, BBC News, Islamabad
The attack on Badaber air base is the first on a military target since a Pakistan navy ship was attacked in Karachi's dockyard in September last year. It is the bloodiest since last December's massacre of 150 pupils and teachers at Peshawar's Army Public School.
The air base - which is essentially a residential complex rather than an operational one - is located on the southern-most tip of Peshawar's administrative limits. It is surrounded by tribal territory, which has been the hub of criminal and militant activity until recently.
The attack comes amid claims of success by the military in its 15-month operation in the tribal region, and may well be an attempt by militants to show they can still hit hard targets.
It also exposes holes in Pakistan's pre-emptive intelligence gathering mechanisms, mainly due to lack of co-ordination and information sharing among various security agencies.
In an email, Pakistani Taliban spokesman Muhammad Khurasani said a "suicidal unit" had carried out the attack.
An un-named military official told the Reuters news agency that the militants had "explosives-laden jackets and were armed with hand-propelled grenades, mortars, AK-47 rifles".
It is so far unknown if the militants had any insider support, as has been the case in previous attacks.
Pakistan's Prime Minister Nawaz Sharif condemned the attack, saying: "Terrorists will be rooted out from the country."
The military launched operations in North Waziristan in June 2014 to target militant hideouts, involving air force and ground troops.
Correspondents say this has helped lead to a significant reduction in large-scale Taliban attacks in Pakistan.
According to some reports, militant attacks decreased by 70% in 2015.