Dozens of people were killed and 40 inmates escaped in a bloody prison break north of the Iraqi capital for which the Islamic State jihadist group claimed responsibility on Saturday.
The interior ministry said six guards and 30 detainees were killed Friday while 40 inmates escaped from the police compound prison in Khalis, around 50 kilometres (30 miles) from Baghdad.
"One of the prisoners seized a weapon from a guard. After killing him, the inmate headed up to the weapons storage and he seized more weapons," spokesman Brigadier General Saad Maan told AFP.
"Clashes erupted inside. We lost a first lieutenant and five policemen, forty prisoners fled. Nine of them were held on terror charges and the rest for common crimes," he said.
Maan added that 30 prisoners who had been held on terrorism charges were killed in the clashes.
The Islamic State group gave its own account, in a statement posted on jihadist forums, and claimed that it simultaneously targeted police outside the prison.
"Brothers inside the Khalis prison were able to coordinate with brothers outside the prison," the group said.
"Fifteen IEDs (improvised explosive devices) were detonated against army and police convoys and vehicles around the prison," the statement said.
"Our brothers managed to take control of the weapons storage and attack the apostates, killing many … Thanks to God, more than 30 knights of the Islamic State were freed," it said.
Iraq has been plagued by several prison breaks over the past two years, including in the early days of a huge June 2014 offensive by IS.
The jihadists freed and recruited hundreds of Sunni inmates, including in the cities of Tikrit and Mosul.
A mass break-out at Abu Ghraib prison in west Baghdad during which more than 500 inmates, including top Islamist militants, escaped in July 2013 is considered to be one of the key moments in the rise of IS.
At least 11 people were killed on Friday in a double suicide attack claimed by IS against a Shiite mosque in Baladruz, east of Khalis in Diyala province, northeast of the capital.
Government and allied forces clawing back territory from the jihadists announced earlier this year that Diyala had been completely liberated but sporadic attacks have continued.
IS also claimed a car bomb targeting Shiite pilgrims in central Baghdad on Saturday in which at least seven people were killed.