It was the second attack on Shi'ites in less than a week in Pakistan's central Punjab province, and posed a new challenge for military ruler President Pervez Musharraf in holding his restive nation together.
"We have placed nine bodies in a hospital room and treated a number of wounded, at least 10," a doctor at the Holy Family Hospital in Rawalpindi said. "I have lost count how many of them have come here."
Police said three gunmen opened fire on worshippers during evening prayers in the Shah-i-Najf mosque. A witness said there were up to 40 worshippers in the mosque at the time.
"It was a sudden firing and many of us immediately lay on the floor," one of the wounded, Anjum Abbass, told Reuters.
The wounded included two teenaged boys.
Rawalpindi's Deputy Inspector-General of Police, Fareed Nawaz, told reporters it was an act of terrorism.
Witnesses said three young men riding a motorcycle arrived at the mosque as evening prayers were being held.
Police said two of the men went inside the mosque and sprayed worshippers with bullets, while the third stood guard outside.
"This is terrorism not sectarianism," Nawaz said. "We believe they used automatic weapons, which we believe were Kalashnikovs."
"It's hue and cry all over the hospital," one witness said. "I saw two lady doctors weeping."
Relatives of the dead and wounded filled hospital corridors checking the whereabouts of family members.
Mainly Sunni Muslim Pakistan is plagued by sectarian violence, which claimed 400 lives in 2001, particularly at places of worship.
Gunmen shot dead a local Shi'ite leader and four members of his family in the Punjab province town of Chichawatni last Thursday. Police said men with automatic weapons broke into the house of Tanvir Shah and fired on his family as they slept.