Iraqi militants unleashed a string of bombings and other attacks primarily targeting the country's Shi'ite community, leaving at least 40 dead.

Authorities had increased security in hopes of preventing attacks during the four-day Eid al-Adha celebrations, when people are off work.

The deadliest attacks happened in the evening in the Shiite neighbourhood of Sadr City in Baghdad.

Police said a car packed with explosives blew up near a market, killing 12 and wounding 27. Half an hour later, a second car bomb went off in one of Sadr City's bus stations, killing 10 and injuring 31.

Earlier in the day, a bomb exploded near playground equipment in a market on the capital's outskirts in the eastern neighbourhood of Bawiya. Eight people died, including four children. Another 24 people, including children, were wounded.

A spokesman for the interior ministry said the bombers targeted the edge of the city because they were unable to reach the centre.

Elsewhere, a bomb attached to a bus carrying Iranian Shiite pilgrims killed five and wounded nine.

In Mosul, gunmen broke into the houses of two families, killing a boy and his parents in one and a mother and daughter in the other. A bomb exploded near the house of another family, wounding six.

In Tuz Khormato, north of Baghdad, a car bomb exploded wounding 11.