At least 60 people have died in clashes after suicide bombers and fighters attacked a bus transferring convicts from a prison north of Baghdad, according to Iraqi police.
Security and medical officials said on Thursday that about 50 prisoners were among the dead, many of them burnt beyond recognition. A number of policemen also died.
"At least 60 people, prisoners and policemen, were killed in a suicide attack followed by several IEDs (improvised explosive devices) and shooting," an Interior Ministry official told the AFP news agency.
It was not immediately clear who launched the assault, which targeted a security convoy escorting a bus that was transferring the 60 prisoners, many of them held on terrorism charges, from the main prison in Taji, roughly 25km north of Baghdad.
The attack took place at about 4am local time (0100 GMT), just hours before Ban Ki-moon, UN secretary-general, was to hold talks with Nouri al-Maliki, Iraqi prime minister, in an effort to spur international mobilisation against self-declared armed groups operating in the country.
It came a year almost to the day after fighters attacked the same prison in Taji and another facility in Abu Ghraib, west of Baghdad, killing at least 20 members of Iraq's security forces.
Officials said at the time that no inmates had escaped from Taji prison but 500 broke out of Abu Ghraib.
Sectarian attacks have escalated sharply since the Islamic State advance towards Baghdad, the most serious challenge to the Shia-led government of Maliki since the withdrawal of US forces in 2011.
Iraq's politicians have been in deadlock over forming a new government since an election in April.
On Thursday, Kurdish politician Fouad Massoum was named the new president following a parliamentary vote.
Massoum, 76, is one of the founders of current President Jalal Talabani's Patriotic Union of Kurdistan party.
He is considered a soft-spoken moderate, known for keeping good relations with Sunni and Shia Arab politicians.
The vote for president - a largely ceremonial post - was delayed for a day when the Kurdish bloc requested more time to select a candidate.
They named Massoum as their pick late on Wednesday.
Under an unofficial agreement dating back to the 2003 US-led invasion, Iraq's presidency is held by a Kurd while the prime minister is Shia and the parliamentary speaker is Sunni.