Taliban militants wearing explosive vests and armed with rocket-propelled grenades attacked a Pakistani air force base possibly linked to the country's nuclear program and fought a fierce, two-hour battle Thursday that left one security official and nine insurgents dead and the base in flames.

Hours later in northern Pakistan, gunmen forced 20 Shia Muslims off buses, lined them up and killed them.

The separate incidents emphasize two daunting challenges the nuclear-armed country faces. The Pakistani Taliban continue to pose a potent threat despite numerous military offensives against their sanctuaries along the Afghan border. At the same time, sectarian violence plagues the Sunni majority country where Shia Muslims often feel under attack.

While the Pakistani Taliban have carried out hundreds of bombings and other attacks through the country, raids against military bases are somewhat uncommon. The group's spokesman, Ahsanullah Ahsan, said they carried out Thursday's pre-dawn attack as revenge for the death of Pakistani Taliban leader Baitullah Mehsud in a U.S. drone strike in 2009 and the American commando raid that killed al-Qaeda chief Osama bin Laden last year.

The large air base, located only about 40 kilometres northwest of Islamabad, hosts a variety of fighter jets, including F-16s, and contains a factory that makes aircraft and other weapons systems.

Army denies nuclear connection

The weapons development and the presence of jets that could be used to deploy nuclear bombs have raised suspicions among some experts that the base is linked to Pakistan's nuclear arsenal. However, no firm evidence has emerged, since the secrecy of the nuclear program makes independent evaluation difficult. The Pakistani army denies any connection between the base and the program.

Pakistani security stand guard at the entrance of the air force base in Kamra, northwest of Islamabad. Nine militants and one security forces member were killed in the attack, officials say. (B.K. Bangash/Associated Press)

The safety of the country's nuclear weapons has been a major concern for the United States. Western experts say Pakistan has about 100 nuclear weapons and is in the midst of a rapid expansion of its arsenal.

"The great danger we've always feared is that, you know, if terrorism is not controlled in their country, that those nuclear weapons could fall into the wrong hands," U.S. Defence Secretary Leon Panetta told reporters at the Pentagon on Tuesday.

The U.S. has criticized Pakistan for not doing enough to target militants in the country, especially those using Pakistani territory to launch cross-border attacks against NATO forces in Afghanistan. Pakistan has countered by saying its forces are stretched too thin fighting the Pakistani Taliban and their allies, who have waged a bloody insurgency against the government for years that has killed over 30,000 people.

Last major sanctuary

The Pakistani army has carried out numerous offensives against the Pakistani Taliban in the country's semiautonomous tribal area along the Afghan border and appears to be planning an operation in the group's last major sanctuary in North Waziristan.

Panetta told The Associated Press earlier this week that Pakistan has informed American military officials that it plans to launch an operation against the Pakistani Taliban in North Waziristan in the "near future."

Thursday's attack came at around 2 a.m., when Taliban militants opened a barrage of automatic weapons fire and rocket-propelled grenades at the base, according to the air force. Some of them were also wearing explosives strapped to their bodies, it said.

At least one of the rockets hit a hangar, pierced the hangar wall and exploded, damaging one of the aircraft parked inside, said air force spokesman Tariq Mahmood.

After the barrage, the attackers scaled the wall surrounding the air base and an intense firefight ensued, said Mahmood.

Security forces, backed by a team of elite commandos, fought the militants for two hours and were finally able to retake the base, the air force said. By the end of the battle, one soldier was dead and the nine militants were killed, one of them when he blew himself up outside the base perimeter, the air force said.

Found 'a few IEDs'

The head of the base, Air Commodore Muhammad Azam, was wounded in the shoulder, said Mahmood.

Security forces searching the area after the attack found a "few IEDs," which they either removed or destroyed, the spokesman said.

The base is formally known as Air Force Base Minhas. It was named after a pilot, Rashid Minhas, lauded as a hero in Pakistan for foiling attempts by his instructor to defect with an air force plane to archrival India in 1971. To stop the escape, Minhas disabled the controls of the plane the two were flying, and died in the resulting crash.

Half a dozen Taliban militants attacked a major naval base in the southern port city of Karachi in May 2011, killing at least 10 people and destroying two U.S.-supplied surveillance aircraft. It took Pakistani commandos 18 hours to retake Naval Station Mehran, and two of the attackers escaped. That the attackers managed to infiltrate so deep into the high-security base led to speculation they may have had inside information or assistance.

In 2009, militants dressed in fatigues attacked army headquarters in the city of Rawalpindi, just outside Islamabad, and took 30 people hostage. Pakistani commandos finally raided the compound 22 hours later. Three captives and four militants were among those killed.

Taken off bus and shot

There have been at least three attacks in the vicinity of the Minhas base since 2007, but all of them occurred outside the installation.

In the sectarian attack, gunmen forced 20 Shias off three buses in the Naran Valley in northern Pakistan, shot and killed them, said a police official. He spoke on condition of anonymity because he was worried about retribution.

The deputy inspector general of police in Gilgit, Ali Sher, said the victims were travelling from Rawalpindi, near the capital Islamabad, to Gilgit, a mostly Shia area.

There have been several such sectarian attacks in the region in the past by Sunni extremists who do not view Shias as true Muslims.

In February gunmen stopped a convoy of buses in the city of Manshera, ordered selected Shia Muslim passengers to get off and then killed 16 of them.

In April, violence between Sunnis and Shias killed 14 people in and around the town of Gilgit in northern Pakistan.