Islamabad, Pakistan (CNN) -- Four militants armed with guns and grenades stormed a mosque in Rawalpindi frequented by military personnel, killing dozens of people Friday -- most of them children, the military said.
The attack is the latest to shake the garrison city since this year's launch of strong military offensives against Taliban insurgents in the Swat Valley and South Waziristan. Rawalpindi is the headquarters of the Pakistani army.
Maj. Gen. Athar Abbas said Friday's assault killed 36 people and wounded 75.
Among the dead were 17 children, according to the military's Web site. Also killed were an army general and eight other military officials, six of them of senior rank. The remaining fatalities were adults.
"As soon as the mosque's security staff checked me, there was a blast and then a finger hit me, then there was another," Ishtiaq, a driver for a military officer, told GEO TV.
Ishtiaq, who uses only one name, was attending midday prayers.
Rawalpindi is near Islamabad, and the mosque is near national army headquarters. It is located inside a walled residential compound where many military families have homes.
A witness told GEO TV there were up to 300 worshippers at the mosque at the time of the attack.
The militants hurled grenades before opening fire, Rawalpindi Police Chief Aslam Tareen told CNN. He said all the militants died, but he doesn't know how.
"These are not militants," Abbas said. "These are terrorists who killed innocent worshippers."
Retired Gen. Muhammad Yousaf was killed in the attack, said Col. Baseer Haider, a military spokesman. He said Yousaf was a former vice chief of army staff who was second in command during the administration of President Pervez Musharraf.
Abbas said two of the attackers were suicide bombers who blew themselves up inside the Parade Lane mosque; the other two were shot and killed by security forces outside the mosque.
Several explosions were heard inside the mosque around 1:30 p.m. (3:30 a.m. ET), followed by gunfire, Abbas said. The militants entered the compound by climbing over a wall, Tareen said.
This is the first attack in Rawalpindi since a suicide bomber targeted a bank on November 2.
On October 10, militants stormed army headquarters in Rawalpindi, taking several people hostage before security forces killed them.
CNN's Reza Sayah contributed to this report.