Shia political leaders accused US troops on Monday of killing 20 worshippers at the Mustafa mosque on Sunday, but police and residents said many died in clashes between the troops and militiamen loyal to Muqtada al-Sadr, the Shia cleric.
The US military said an Iraqi special forces team - with help from American advisers - raided a meeting hall being used by an "insurgent cell" in the area, killing 16 people and detaining 18.
"Iraqi commandos and soldiers from the Iraqi counter-terrorism force killed 16 insurgents and wounded three others during a house-to-house search on an objective with multiple structures," the US military said.
The statement said that the Iraqi special forces had "received fire almost immediately from several buildings near the target area".
It said that members of the US special forces were present in an advisory capacity and said that "no mosques were entered or damaged during this operation".
Police reported clashes between
US troops and the al-Mahdi Army
Large numbers of weapons were found, including dozens of rifles, rocket-propelled grenades, two heavy machineguns and material to make explosives, the US military said.
It said that a dental technician who had been taken captive the day before and tortured for 12 hours, was rescued in the raid.
There have been conflicting reports from all sides.
Iraqi television showed pictures of corpses on Sunday night inside what it called the Mustafa mosque. Many of the dead were elderly and said to be members of prominent political parties.
The Imam Ali hospital, in nearby Sadr City, reported 17 dead and five wounded.
An al-Sadr aide, Hazim al-Araji, said: "The American forces went into Mustafa mosque and killed more than 20 worshippers ... They tied them up and shot them."
In a sign of how little faith some Iraqis have in US-backed government forces, mourners said only al-Sadr's Jaish al-Mahdi (al-Mahdi Army) could protect them from sectarian bloodshed.
Iraqi TV showed pictures of
corpses inside the mosque
One mourner said: "No one is protecting us. If it wasn't for the al-Mahdi Army, we would be slaughtered in our homes."
Al-Araji called for calm from al-Sadr's followers, but also accused the US of trying to drag the group, which wields considerable power, into a confrontation to obstruct the political process.
A spokesman for Ibrahim al-Jaafari said the prime minister, was "deeply concerned" and had called the US commander in Iraq, General George Casey, who promised an inquiry.
Also on Monday, police said they had found 12 bodies which had been strangled and tortured in Baghdad on Monday, apparently victims of the Shia-Sunni bloodshed.
Scores of bodies, often mutilated, are found across the country every day. Such is the level of killing that the discovery of 30 bodies, many beheaded, on the main road of a village northeast of Baghdad on Sunday, barely drew a mention in local media.
Also on Monday, at least one person died and three were injured when a car bomb exploded in Baghdad's Sadr City, police said.
And a mortar round hit the offices of al-Sadr's organisation in Baquba, 65km northeast of the capital, wounding at least two people, police said.