Updated

Pakistani commandos recaptured a major naval base from Taliban attackers after a bloody and humiliating 18-hour standoff that raised questions about militant infiltration in the security services and the safety of the volatile country's nuclear warheads.

The unusually brazen assault, which the Taliban said was to avenge the killing of Usama bin Laden, was a reminder that the Pakistanis are catching blame from both sides in the aftermath of the May 2 raid by U.S. commandos.

While Americans have accused elements in the Pakistani security services of having sheltered bin Laden in the military town of Abbottabad, the Taliban and Al Qaeda fault the army for its level of cooperation with the Americans. It was the third purported revenge strike in Pakistan since bin Laden's death.

After initially estimating that 15 insurgents were involved in the attack that began late Sunday in the country's commercial capital, Karachi, officials said just six heavily armed, black-clad assailants penetrated into the heart of the Naval Station Mehran after cutting through wire in a quiet section of its eastern perimeter.

The militants destroyed two U.S.-supplied surveillance aircraft and killed at least five navy officers, two paramilitary rangers and three firefighters. Six Americans and 11 Chinese aviation engineers escaped unharmed, authorities said.

Four attackers were killed — one apparently blew himself up — but two managed to escape, said Pakistan Navy chief Nauman Bashir.

After blowing up the aircraft, causing huge fires that lit up the night sky and sent black smoke above the city of 18 million people, the insurgents inside the base managed to evade death or capture into Monday by splitting up and firing on marines and commandos sent to catch them.

Toward early afternoon, the militants were holed up in an office building as navy helicopters flew over the base, and snipers were seen on a runway control tower. A final crack of automatic weapon fire rang out, and the navy soon declared victory.

"Thanks be to God, the base is cleared and the operation is over," said navy spokesman Irfan ul Haq.

Commandos leaving the complex flashed victory signs to reporters.

The base, the home of the Pakistan Navy's air arm, is part of the much larger Faisal air base, and is surrounded by residential and commercial areas. It is about six miles (10 kilometers) from the city's international airport.

Interior Minister Rehman Malik said the attackers were aged between 20 and 25 and the plot was hatched in the Waziristan area close to Afghanistan, from where most of the attackers inside Pakistan — and many in Afghanistan — are believed to train and get shelter.

He showed a picture he took with his cell phone of a dead fighter lying bloodied on the grass. He said the attackers were dressed in black — presumably to avoid detection at night — and looked "like the Star Wars characters."

That the attackers managed to infiltrate so deep into the high-security base led to speculation they may have had inside information or assistance. The base is surrounded by barbed-wire topped walls and dotted with sentry points and cameras.

The military is Pakistan's most powerful institution, but it too has been infected by the anti-Americanism and Islamism coursing through the country over the last 10 years, especially in its lower ranks. The unilateral U.S. raid against bin Laden exacerbated this anger among many soldiers, who saw it as a violation of sovereignty as well as a sign that Pakistani authorities could not be trusted.

The Pakistani Taliban, an Al Qaeda-allied group blamed for hundreds of attacks since 2007, claimed responsibility for the assault on the naval base.

"Sheik Osama bin Laden was a very valuable person and even if we kill thousands of enemies it will not be sufficient revenge," said spokesman Ahsanullah Ahsan in a phone call to reporters. "We also want to harm the military, which is secular and supportive to the Americans but unable to protect either the land or people of Pakistan or Islam."

Al Qaeda and Taliban militants seek to replace Pakistan's secular, American-backed leaders with hardline Islamist rule.

Although Pakistan is battling some insurgents in the northwest close to the Afghan border, it has also been accused of fatally hampering that fight by tolerating others it believes serves its interests in Afghanistan and India. That has fueled suspicion that members of the security services helped shelter bin Laden, who was previously assumed to be living in caves near the Afghan border.

Malik and Bashir hinted that the militants in Sunday's attack had help from abroad, presumably a reference to India, the country's traditional enemy. Such accusations are often heard after high-profile militant attacks, but no evidence is presented.

The charges — repeated by retired generals on talk shows — reflect sentiment in Pakistan over the nature of the enemy. Many prefer to believe conspiracy theories holding India, America and Israel as the country's biggest threat — not fellow Pakistani Muslims who claim responsibility for the strikes.

For those who think this way, the American raid on bin Laden and the militant raid on the base can be conflated.

"After the Osama bin Laden death and now this attack, you see the enemies are after our national assets," Malik said. "They had rocket launchers which no ordinary terrorists can have," he said. "That means they are being energized from somewhere."

In October 2009, militants besieged army headquarters in Rawalpindi close to the capital for 22 hours. At least one former member of the security forces, an army nurse, took part in that attack.

"We know that the Pakistan security establishment has been penetrated by jihadists," said Kamran Bokhari, an analyst with STRATFOR, a private security think tank in Austin, Texas. "There is ample evidence to show this. Are there such people inside the nuclear establishment? One can never rule out the possibility."

Pakistan does not reveal where it keeps its nuclear weapons. The Mehran base is 15 miles from Masroor air base, the country's biggest, and a rumored home to some nuclear weapons.

Still, Kamran and other experts said nuclear facilities are much better protected than regular military bases, even the army headquarters in Rawalpindi. And that attacking a naval facility is vastly easier than sending militants into a base and expecting them to get out with nuclear material.

"For Pakistan, the nukes are the most prized possession of the country. It is going to take much more than 15 to 20 men to get them," Kamran said.