The US military said on Saturday the fighting occurred in the Shia slum of Sadr City in the Iraqi capital earlier in the week.
"A number of patrols around Sadr City were ambushed by small-arms fire and RPGs [rocket-propelled grenades]. It went on throughout the day," said a US military spokesman, referring to the fighting that raged on Thursday.
"Around about 20 were killed or wounded," he said.
Small, armed bands attacked the US patrols as they went about their work in Sadr City, a packed neighbourhood of around two million people, which is named after the slain father of firebrand Shia leader Muqtada al-Sadr.
"We rendered the teams ineffective," said the spokesman, though he declined to give an exact breakdown of the dead and injured.
"There were no coalition casualties or damage to our equipment," he added.
Family and medical sources said six Iraqis lost their lives in Sadr City last Sunday, while two Iraqi children were killed and 23 people injured in fighting on 11 June.
The impoverished neighbourhood is an al-Sadr stronghold. Mahdi Army fighers have clashed repeatedly with US troops since the Shia leader launched his uprising against the occupation more than two months ago.
The US military also announced on Saturday that anti-occupation fighters killed a US 1st Infantry Division soldier near the town of Baquba, northeast of Baghdad, on Friday evening.
A spokesman said the soldier died after being ambushed by armed fighters. Since the invasion of Iraq last year, at least 613 US soldiers have been killed in action.
Aljazeera's correspondent reports that, based on information from the Iraqi police, 13 Iraqis were killed and 53 injured in Buhruz, south Baquba.