The Islamic State in Iraq and the Levant (ISIL) said in a statement it had acted in response to the prisoner killings, an apparent reference to the execution of 17 people in Iraq this month, most convicted on terrorism charges.
"We will avenge the blood of our brothers," said the statement, posted on a website used by Islamist militants. An insurgency by Sunni Islamist militants, including the local branch of al Qaeda, against Iraq's Shi'ite-led government, has been gaining momentum 18 months after the last US troops withdrew.
The Islamic State of Iraq has significantly increased its attacks this year. More than 1,000 Iraqis were killed in July, the highest monthly death toll since 2008, according to the United Nations.
More than two years of civil war in neighbouring Syria have aggravated deep-rooted sectarian divisions and shaken Iraq's fragile coalition of Shi'ite, Kurdish and Sunni factions. The renewed violence has sparked fears of a return to the large-scale sectarian slaughter in 2006 and 2007.