The killings happened late Monday, on a day that saw a wave of violence sweep across Iraq, from the northern city of Mosul to the Shiite heartland. They raised the day's death toll to 70.
Officials with the Ministry of Interior and the town hospital say the gunmen walked into the Sunni mosque in Youssifiyah during evening prayers, took the seven men outside and shot them.
The men were all members of an anti-al-Qaida militia. Youssifiyah is about 12 miles (20 kilometers) south of Baghdad.
The officials spoke on condition of anonymity because they were not authorized to speak to the media.