Prison in Iraq's Diyala province. More than
Prison in Iraq's Diyala province. More than 40 prisoners escaped Khalis prison in an Isis plotted jail break. Getty Images

Security failings allowed 42 inmates to escape in a prison bust allegedly plotted by Islamic State (Isis), said the mayor of an Iraqi town.

The Iraqi Interior Ministry said that an investigation was underway into the prison break in Khalis, Diyala province, about 50km (30 miles) miles of Baghdad.

In a statement, it said that "shortcomings in prison administration" were to blame, while the town's mayor pointed to intelligence failings.

"Lack of intelligence was the main reason behind the prison break. If we had had information, this would not have happened," Uday al-Khadran told AFP by phone.

He said that the prison break was planned, and that improvised explosive devices (IED) had been placed along a road near the prison.

Authorities initially said that the prisoners had escaped after a riot, while pro-Isis media said the militant group said it helped them escape with the use of explosives.

He said that 88 prisoners were being kept in the detention centre in the town's police station, and said he had urged authorities not to keep the prisoners, who included "a large number of dangerous terrorists" at the centre, after they were transferred from provincial capital Baquba.

Shia militant in Khalis
A shi'ite militant in Khalis, Iraq, after the town was retaken from Isis Getty Images

"I refused that they be put there because it was near the main road and an easy target, but the security authorities did not listen to me," he said.

Al-Khadran confirmed that 42 prisoners had escaped while 35 other were killed, along with six members of security forces and three civilians. Other official sources place the number of casualties higher.

The prison was reportedly holding about 300 inmates, and it is not known if any high profile Isis commanders were among those who escaped.

"It was not clear if any high-profile prisoners were held at Al-Khalis," said the Head of Diyala's Security Committee, Seyyid Sadiq al-Husseini.

Al-Khadran said that an influx of refugees fleeing fighting between government forces and Isis, and a lack of presence by security forces in areas re-taken from the militant group, were behind the unrest in the area.

The town was retaken from Isis by Iraqi government forces supported by Shi'ite militias in February.