Media playback is unsupported on your device Media caption Tulip Mazumdar at Kamra air base said the militants were shot by security officials

Gunmen have attacked a Pakistani military air base triggering a fierce firefight with security forces that lasted several hours.

Several militants wearing military uniforms and suicide belts stormed Minhas air base at Kamra, near the capital Islamabad, just before dawn.

Eight militants were killed, one soldier also died and the base commander was seriously injured.

All of Pakistan's air bases were placed on high alert following the attack.

The Pakistani Taliban said they carried out the attack.

The BBC's M Ilyas Khan, who is at the base, says that now that the attack has been repelled, the search is on for militants who may have escaped.

Shortly after the attack began, at around 02:00 local time (21:00 GMT on Wednesday) a police officer outside the air base, Hafeez Aulakh, said he could hear intense gunfire and see flames leaping up from inside, the Associated Press news agency reported.

Analysis This is the third major attack in about as many years in which militants were able to breach security at a high value military installation. Officials say they will be investigating, among others things, the possibility of insider collaboration, as happened during another spectacular attack at a naval base in Karachi last year. Troops are searching the factory area inside the sprawling air base at Kamra. The hunt for militants is also taking place in about five or six villages located just outside the western perimeter of the base. Militants entered the base from these villages. All approach routes to the base have been sealed by the police. Local journalists who gathered near it for the customary pre-dawn meal of the fasting month of Ramadan said that they heard the bang of the rockets that hit an aircraft parked in the base. Firing continued for several hours subsequently. The attack comes days after American claims of an impending Pakistani operation in the militant haven of North Waziristan tribal region.

The attackers initially fired rocket-propelled grenades from outside, which damaged one aircraft.

Air force spokesman Tariq Mahmood said the attackers then scaled a wall to get inside the base, though they did not reach the hangars there.

He added: "We are checking every inch of the complex to make sure there are no other miscreants."

Reporters who reached the scene several hours later said there was no sound of gunfire.

Base commander Air Commodore Muhammad Azam was reported to be seriously wounded but in a stable condition in hospital.

Earlier reports said two soldiers had died, but this was later revised.

Officials have denied speculation that the base is connected to Pakistan's nuclear weapons programme.

Minhas is one of Pakistan's biggest air bases with about 30 fighter jets including new JF-17 planes - jointly developed with China - that are being assembled there. It is about 60km (35 miles) north-west of Islamabad.

The BBC's Tulip Mazumdar - also at the base - says Pakistan insists it can protect its military targets, but this latest attack will again raise concerns over whether it is in control of its own security.

In May 2011, militants attacked the Mehran naval air base in Karachi, killing 10 soldiers.

It took security forces about 17 hours to secure the base on that occasion.

In 2009 a suicide bomber killed six people at a military checkpoint in Kamra, in Punjab province.