Pakistan air force base in Peshawar attacked by Gunmen
The gunmen, dressed in police uniforms, stormed the Badaber air base on Friday morning, Major General Asim Bajwa said.
Sixteen of the victims were killed during morning prayers at a mosque inside the compound, Gen Bajwa added. The other victim was an army officer.
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.
Reports say about 20 people, including 10 soldiers, were injured in the exchange of fire.