Militants armed with guns and rocket launchers stormed a key Pakistani air force base before dawn on Thursday, sparking hours of heavy clashes that killed eight people, officials said.

Two security officials were among the dead at PAF Base Minhas in Kamra, again showing that suspected Islamists can penetrate sensitive military sites in the nuclear-armed country, which has been battling a Taliban insurgency for five years.

The Air Force confirmed five hours after the attack began that all six gunmen had been killed at the base, home to the Pakistan Aeronautical Complex that assembles Mirage and, with Chinese support, JF-17 fighter jets.

“Two security officials and all six attackers have been killed,” a spokesman told AFP by telephone.

The attack on the facility, about 60 kilometres (37 miles) northwest of Islamabad, began shortly after 2:00 am (2100 GMT Wednesday).

“Intense fire” was exchanged between security personnel and the “group of terrorists”, the Air Force said.

The sound of gun and rocket fire, as well as hand grenades exploding, could be heard, said an official speaking from inside the base on condition of anonymity.

Special forces were scrambled to the scene as other staff were told to remain in barracks and ambulance sirens screamed in the area.

At least one of the gunmen had been wearing a suicide vest, the air force spokesman said.

There was no immediate claim of responsibility but Islamist militants linked to the Pakistani Taliban have targeted a string of military bases since rising up against the government in July 2007.

It was the first assault on an air base since May 2011, when it took 17 hours to quell an attack in Karachi claimed by the Taliban, piling embarrassment on the armed forces weeks after US troops killed Osama bin Laden in Pakistan.

But it was the second deadly attack in weeks on troops near the relatively secure capital, after gunmen on July 9 killed seven security personnel who had camped by a river less than 160 kilometres (100 miles) southeast of Islamabad.

Despite a relative lull in high-profile attacks, Pakistan has been on alert for violence to coincide with its independence day on Tuesday this week and the Muslim festival of Eid, which is expected to begin at the weekend.

On Tuesday, the head of the army, General Ashraf Kayani, used his independence day address to describe the war on terror as “our own war and a just war too”.

He acknowledged the difficulties of fighting his own people, but said “no state can afford a parallel system of governance and militias,” and called on the nation to stand united or face the risk of a “civil war situation”.

Pakistan says 35,000 of its people, including more than 3,000 soldiers, have been killed as a result of terrorism since the 9/11 attacks and the 2001 US-led invasion of neighbouring Afghanistan.

The Kamra base, in central Punjab province, has been targeted at least twice in recent years.

On October 23, 2009 a suicide bomber killed six civilians and two Pakistan Air Force personnel at a checkpoint outside the base during morning rush hour.

On December 10, 2007, a suicide car bomber struck a school bus, wounding at least five children of base employees.