BAGHDAD - Six guards and 30 detainees were killed in a prison break north of the Iraqi capital during which 40 inmates escaped, an interior ministry spokesman said Saturday.

The spokesman said the break on Friday started when an inmate grabbed a weapon from a warden at the prison on the main police compound in Khalis, a town 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,’ 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.

Iraq has been plagued by several prison breaks over the past two years, including in the early days of the huge June 2014 offensive by the Islamic State jihadist group. The jihadists freed and recruited hundreds of Sunni inmates, including in the cities of Tikrit and Mosul. A mass break-out at the Abu Ghraib prison west of 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. Moreover, the deaths occurred on site at the Al-Khalis prison, about 80 km (50 miles) northeast of Baghdad, and during a manhunt for the fugitive convicts overnight, said the officials.

They said 14 policemen were wounded in the latest violence to highlight the multiple security challenges facing Iraq, which is battling an insurgency from hardline militant group Islamic State. The officials said Al-Khalis held about 300 people convicted of terrorism charges. In Iraq, terrorism cases are mainly linked to Islamist militants, including Islamic State, which controls large parts of Iraq and Syria and which the Iraqi military is fighting to dislodge.

It was not clear if any high-profile prisoners were held at Al-Khalis, the head of Diyala’s security committee, Seyyid Sadiq al-Husseini, said. ‘The inmates started fighting among themselves, which drew the attention of the police guards who went to break up the fight,’ said a police source, asking not to be named.

‘Then the prisoners attacked them, stripped them of their weapons and started a riot while also managing to capture the armory of the prison.’ Authorities declared a curfew in Al-Khalis and raided houses in search of escaped convicts, said another police source.

The Iraqi government is battling Islamic State in the north and west of the country with the help of U.S.-led air strikes, and is also trying to contain widespread sectarian violence. A car bomb in Baghdad on Saturday killed seven civilians and wounded 14 others, police and medical sources said. Moreover, A car bomb blast targeting Shiite pilgrims on an annual march to a Baghdad shrine killed at least seven people Saturday and wounded 20, security and medical sources said.

‘A car parked near Kahramana square exploded. It was targeting Shiite pilgrims,’ a police colonel said. An Iraqi interior ministry official said at least seven people were killed and 20 wounded in the blast, which sent a plume of dark smoke billowing into the sky above the central neighbourhood of Karrada. A medical source confirmed the casualty toll. Worshippers have in recent days started walking to Kadhimiya, site of a shrine dedicated to Imam Musa Kadhim, the seventh of 12 revered imams in Shiite Islam, who died in 799 AD. Security forces close some streets to traffic for the days-long pilgrimage, during which the marching worshippers and the hundreds of tents along their path where they can rest, eat and drink are considered particularly vulnerable to attacks.