Video caption Watch protesters running away from the sound of rapid gunfire

Nearly 40 people have been killed in Iraq on one of the bloodiest days since anti-government protests began last month, medics and officials say.

At least 25 people died when security forces opened fire to clear bridges in the southern city of Nasiriya.

Another four protesters died in Baghdad and 10 more in the city of Najaf, where Iran's consulate was also burnt.

Iraqis have been taking to the streets to demand more jobs, an end to corruption and better public services.

The Iraqi military has announced it is setting up military "crisis cells" to quell unrest. The military command said an emergency unit had been created to "impose security and restore order".

At least 350 people have been killed and thousands wounded since the unrest began.

What happened in Nasiriya and Baghdad?

The military had sent reinforcements to tackle unrest in Nasiriya, the birthplace of Prime Minister Adel Abdul Mahdi and a hotspot for protests.

Troops used live ammunition and tear gas to clear sit-ins on two bridges, medics and security sources reported, with protesters responding by torching a police station.

Image copyright AFP Image caption Protesters near Ahrar Bridge in Baghdad, where at least four people died on Thursday

Amnesty International's Middle East research director, Lynn Maalouf, said the scenes "more closely resemble a war zone than city streets and bridges", accusing security forces of "appalling violence against largely peaceful protesters".

Agence France-Presse, quoting Iraqi state media, said Mr Abdul Mahdi had now sacked Gen Jamil Shummary, one of the commanders sent to restore order in Nasiriya.

Late in the evening, Iraqi media reported that the governor of Dhi Qar, of which Nasiriya is the capital, had resigned.

Live rounds were also fired at the strategic Ahrar Bridge in Baghdad, sources said, as protesters tried to cross towards the so-called Green Zone that hosts the country's parliament.

As well as the four who died there, more than 20 people were wounded.

What happened in Najaf?

Clashes broke out between protesters and police in the city on Thursday, leaving three demonstrators dead and 18 more wounded, medical sources said.

Security forces were cracking down after protesters set fire overnight to the Iranian consulate in the city - the seat of Iraq's Shia religious authority and the location of the revered Imam Ali shrine, where the son-in-law of the Prophet Muhammad is buried.

Protesters chanted "Iran out of Iraq" as flames engulfed the building.

Reports say staff at the consulate managed to flee just before protesters broke in. Iran swiftly condemned the attack and said that the Iraqi government was responsible for protecting its consulate.

Image copyright AFP Image caption Protesters chanted "Iran out of Iraq" as the consulate burned on Wednesday night

This is the second attack on an Iranian consulate in Iraq this month after an office in the Shia holy city of Karbala was targeted three weeks ago.

Although Iraq's anti-government protests have been directed mainly at the country's political leaders, many of those taking part have also expressed anger at Iran's influence over Iraq's internal affairs, which has steadily grown since the US-led invasion that toppled Saddam Hussein in 2003.

Protesters accuse Iran of complicity in what they see as Iraq's governance failure and corruption.

What's the background to the protests?

Mr Abdul Mahdi took office just over a year ago, promising reforms that have not materialised.

Young Iraqis angered by his failure to tackle high unemployment, endemic corruption and poor public services took to the streets of Baghdad for the first time at the beginning of October.

Video caption Safaa al Saray died after being shot in the head with a tear gas canister

After the first wave of protests, which lasted six days and saw 149 civilians killed, Mr Abdul Mahdi promised to reshuffle his cabinet and cut the salaries of high-ranking officials, and also announced schemes to reduce youth unemployment.

Video caption The story behind an abandoned high-rise taken over by protesters in Baghdad.

But the protesters said their demands had not been met and returned to the streets in late October.

The demonstrations escalated and spread across the country after security personnel responded with deadly force.

President Barham Saleh has said Mr Abdul Mahdi will resign if parties can agree on a replacement .