Al Jazeera's Imran Khan, reporting from Rawalpindi, said that the Taliban consider "this mosque [to have been] a fair target - that it was not a religious establishment because it was attended to by the Pakistani army".

In depth

  Video: Civilians flee Pakistani army offensive
  Video: Security crisis in Pakistan
  Video: Pakistan army HQ attacked
  Profile: Pakistan Taliban
  Witness: Pakistan in crisis
  Riz Khan: The battle for the soul of Pakistan

"This attack took place in a residential neighbourhood. To get into the neighbourhood, you need to show your ID [and] your car is searched," he said.

"This is supposed to be one of the most secure areas of Rawalpindi, so how these people got in is a big question.

"The other big question is 'if the Taliban can strike here, how on earth can we protect ourselves?'"

Police and witnesses said seven or eight gunmen were armed with assault rifles and hand grenades when they entered the mosque.

"They threw three grenades inside the mosque, one was thrown on the ladies' side, and two grenades were thrown inside the [men's section of the] mosque," one witness told Al Jazeera.

"I could only hear the shouting of the people."

'Significant' breach

The attack appeared to be the latest in a series to hit Pakistan in recent months as the military presses ahead with an offensive against al-Qaeda and Taliban fighters in the country's northwest.

The United States condemned the assault, saying it underscored the need for Washington to support Islamabad in fighting the Taliban.

"These attacks highlight the vicious and inhuman nature of this  enemy whose true target is the democratically elected government of  Pakistan and the security of all Pakistanis," Ian Kelly, US state department spokesman, said.

He added that the attacks reinforce the "need for us to support the government of Pakistan".

Peshawar blast

Separately on Saturday,  there was panic in Peshawar when a blast killed at least three people and injured several others.

A blast in Peshawar was found to have been caused by a chemical reaction [EPA]
The blast was initially reported as an attack, but authorities later said that the explosion had been caused by a chemical reaction, and ruled the possibility of an attack.

"It was a low intensity explosion caused by a chemical reaction," Shafqat Malik, the local bomb disposal chief, told the AFP news agency.

The region's information minister had earlier said the blast was caused by a car bomb detonated by "remote control", but police confirmed to Al Jazeera that the blast was an accident.

The rising tension across Pakistan comes amid a military offensive against suspected Taliban bases in South Waziristan.

About 30,000 government troops have been ranged against 10,000 fighters suspected of having links to the Taliban and al-Qaeda since mid-October. 

While the military campaign has gone better than expected, some politicians and many ordinary Pakistanis say that the government should negotiate with the fighters.

The United States is unable to send troops into the border region, but has launched at least 60 aerial bombing raids at targets there over the last year.

Those attacks have killed scores of alleged pro-Taliban fighters but they have also been criticised by the Pakistan government as an infringement of the country's sovereignty.

US officials said on Friday that they were looking at increasing the frequency of the raids and expanding them into Pakistan's western province of Baluchistan.