A Taliban suicide squad targeted Pakistani military officers and their families praying at a mosque Friday close to army headquarters in a gruesome display of the militants' ability to strike at the center of power in this U.S.-allied, nuclear-armed nation.

The barrage of bombs and bullets left 37 people dead, including seven senior officers and 17 children.

The deaths of so many top brass inside a heavily fortified area a few miles from the capital was a major coup for the Pakistani insurgents, who are under pressure as the army pushes an offensive against their stronghold of South Waziristan along the Afghan border.

Friday's carnage also dramatized the risks Pakistan faces if it steps up its support for the United States in the war against Islamic extremists on its side of the border with Afghanistan.

President Barack Obama believes Pakistan is a key partner in that war, but critics contend that Pakistan, hedging its bets in the event the Taliban eventually regain power in Kabul, has held back against Afghan insurgents who use the lawless border region as a safe haven.

The attack on the mosque, which was largely reserved for military families, was the latest in a relentless Taliban onslaught against mostly military targets across Pakistan. It came nearly two months after the brazen siege of the army headquarters on Oct. 10, when insurgents held dozens hostage in a 22-hour standoff that left 23 people dead including nine militants.

By targeting a packed mosque during Friday prayers, the militants showed they cared little about igniting a possible backlash in this overwhelmingly Muslim country. Authorities urged clerics who had so far avoided publicly criticizing the militants to do so.

The attack began shortly after 1:30 p.m. when the assailants lobbed hand grenades to break through a checkpoint close to the mosque, said Yasir Nawaz, a police official at the scene.

Witnesses said two of the militants then stormed the mosque, while others ran into buildings nearby.

They wore suicide belts under traditional baggy Pakistani clothes, lobbed grenades and sprayed automatic weapons at worshippers.

"They were killing people like animals," witness Nasir Ali Sheikh. "Whoever they saw they shot at. They were well trained and moved very quick."

At least four attackers took part in the attack, which left the walls of the mosque smeared with blood and victims lying on abandoned prayer mats.

Security forces exchanged fire with the assailants for an hour, killing them or watching them blow themselves up. Reporters were prevented from getting close as helicopters hovered overhead and trucks carrying commando teams and ambulances raced to the scene.