Violence in Iraq, including an attack by gunmen on workers on a gas pipeline from Iran, killed 37 people on Friday and raised fears the country is falling back into all-out conflict.

Unrest has reached a level this year not seen since 2008, when Iraq was just emerging from a period of brutal sectarian killings.

Gunmen in three vehicles attacked the gas pipeline workers near Baladruz, northeast of Baghdad, killing 15 Iranians and three Iraqis, police officers said.

The attack also wounded five Iranians and three Iraqis.

South of Baghdad, a car bomb exploded in Madain, killing at least six people and wounding at least 13, while another car bomb near a fish market in Nahrawan killed four people and wounded at least 12.

In Baghdad itself, at least 22 "terrorism" suspects escaped a detention facility in Kadhimiyah, the latest in a long line of prisons breaks in Iraq.

A police colonel said detainees had seized weapons from guards early on Friday, killing two, after which 26 people arrested for "issues related to terrorism" escaped.

Security forces killed one escaped detainee and captured 14, the colonel said, and a medical official confirmed two guards and a detainee had been killed.

The interior ministry said 22 suspects had escaped, but one was killed and all but three others captured.

In July, militants launched coordinated assaults on two prisons near Baghdad, sparking clashes with security forces that lasted for hours.

More than 500 prisoners, including senior Al-Qaeda leaders, escaped. The clashes also killed 20 members of the security forces and 21 prisoners, officials said.

Al-Qaeda-linked militants, government blamed for spike

More people died in the first eight days of this month than in the whole of last December, according to AFP figures based on security and medical sources.

Officials have blamed the violence on Al-Qaeda-linked militants emboldened by the civil war in neighbouring Syria, but analysts and diplomats also say the government has not done enough to address underlying domestic grievances fuelling the violence.

Members of the country's Sunni minority, who complain of discrimination at the hands of the Shiite-led government, have held demonstrations for almost a year.

Unrest spiked after security forces stormed a Sunni Arab protest camp north of Baghdad in April, sparking clashes that killed dozens of people.

The government has made some concessions aimed at placating Sunni Arabs, including freeing prisoners and raising the salaries of anti-Al-Qaeda fighters. It has also trumpeted security operations against militants.

But the daily attacks have shown no sign of abating and violence has killed more than 6,400 people since the beginning of the year, according to AFP figures.