BAGHDAD - Iraq's capital has become a military camp for Shia armed factions as government fighters and those loyal to Moqtada al-Sadr build their forces after thousands of the Shia cleric's supporters stormed Iraq's parliament on Saturday.

The buildup threatens to spill over into an internal Shia confrontation, and hinders government attempts to fight the Islamic State group in the west and north of the country as thousands of men are withdrawn from the front lines.

Roads leading to Baghdad's Green Zone - which houses embassies, the Iraqi parliament and the airport - have turned into one long line of checkpoints, with hundreds of armoured vehicles and thousands of fighters from the Shia "popular mobilisation" force deployed to protect its security.

The distance between the armoured vehicles is no further than 50m. All bristle with dusty and tired-looking fighters carrying machineguns and RPGs.

Shia armed faction commanders and Iraqi security officials told Middle East Eye that most men now in Baghdad had been redeployed from the front lines in northern and western Iraq "to protect the state and the government".

Sadrists storm the Green Zone in Badghad (AFP)

"We have deployed some of the troops around Baghdad as we know that the sleeper cells of Daesh (IS) in these places would take advantage of such circumstances to carry out more attacks," Ahmed al-Assadi, the commander of the Shia armed faction, Jund al-Imam, and a spokesman for the Popular Mobilisation" troops, told MEE.

"Also, we have deployed inside Baghdad [around the Green Zone] to protect the state and the government institutions."

The militias appear to be at odds with prominent Shia cleric Sadr who separately moved thousands of men from his Saraya al-Salam (peace brigades) from western Samarra, a city some 50km north-east of Baghdad, and deployed them to his strongholds across the capital.

The rift has been growing for months as Sadr has striven to push for a new cabinet line-up that would challenge the dominance of Iraq's well-entrenched political blocks. While Sadr and Prime Minister Hayder al-Abadi have both backed a new cabinet made up largely of bureaucrats, most MPs have striven to block their moves, seeing them as a challenge to their own power.

The build-up of the two potentially hostile Shia forces has since helped to create a volatile atmosphere in the capital not seen for years.

A day after Sadr's supporters stormed parliament on Saturday, these tensions threatened to break out into an all-out confrontation.

"Shia-Shia fighting is a red line for us, but if anyone threatens the state, the government and the political system, we would fight him," a prominent Shia militia commander told MEE.

"It does not matter whether he is a Shia or not. We are fighting Daesh [IS] because they threaten the state, so what is the difference?"

Commanders and security officials said regional and international powers had intervened to prevent fighting on the streets on Sunday, and pushed Sadr to "avoid the outbreak of a Shia-Shia fighting".

At the last minute, as a confrontation seemed inevitable, Sadr asked his followers to leave the Green Zone and go home.

"Sadr has achieved all what he was looking for by storming the Green Zone. He got back the trust of the masses and assurance that the army will always stand with the people," a Sadrist leader, familiar with the talks to defuse the crisis, told MEE on the condition of anonymity.

"He did not want to collide with other Shia and the pressures of Iranians and Americans were very big," the leader said.

On Monday, Sadr left to Iran and many sources suggested that he will meet the Iranian Supreme Leader Ali Khamenei.

The villain of the piece

But tensions are still running high days after the storming of parliament, the culmination of months of protests over corruption by Iraqis and infighting among political factions over a reform programme proposed by Abadi.

Iraq's government has since 2003 been built on a quota system ensuring representation of all Kurds, Sunnis and Shia political parties.

Critics, including Sadr, say the system has encouraged corruption in government, and want it replaced.

The storming of parliament came after Sadr said in a televised speech on Saturday that his supporters should take their Green Zone demonstrations "to a higher level".

Within 20 minutes, dozens of demonstrators had climbed the six-metre blast walls surrounding the zone.

An Iraqi soldier gestures in front of Sadrists in Green Zone protest (AFP)

Security forces did little other than fire warning shots in the air, officials said. Protesters who made it inside then opened security gates for thousands waiting on the outside.

Security officials working inside the zone told MEE that demonstrators reached the cabinet offices, Abadi's office and the hospitality palace of the prime minister, but did not storm them.

Instead, demonstrators stormed the parliament chamber, smashed some furniture, beat several MPs and destroyed vehicles.

In the evening, Sadr called them to leave the building and move to gather and camp overnight in "celebration square", where the former Iraqi leader, Saddam Hussein, held annual military parades and festivals.

Who let the crowd in?

"The forces in charge of securing in the Green Zone did not even try to stop the demonstrators," a senior Iraqi security officials said. "Initial investigations have revealed that officers received orders to not confront the protesters and let them get in."

"Our investigations suggest that Lieutenant General Mohammad Ridha, the commander of the special forces in charge of Green Zone security, gave that order but so far, we cannot confirm whether it was him or someone else," the official said.

Ridha, a Shia military officer, received Sadr and publicly kissed his hand on 27 March, when Sadr began a sit-in at the entrances of the parliament as he called for a new cabinet of "technocrats" to be installed.

The heads of the parliamentary blocs have blamed Abadi for Saturday's break-in, saying it was planned by the prime minister in agreement with Sadr to "press the political blocs" and force them to vote on the cabinet reshuffle.

"The commander in chief of the armed forces (Abadi) bears the full responsibility for any security breach or assault on the institutions of the state, its entity and its prestige," said Salim al-Jabouri, parliament's speaker.

"He has to take all measures to protect every Iraqi citizen, as well as the representatives of people."

Abadi however looked relaxed as he walked among demonstrators on Saturday in video footage released by his media office.

He also continues to enjoy the support of the US and the international community. To remove him from office would not be as simple as many Iraqi factional leaders believe.

"He seems to be in a very strong position. Obviously we support him strongly because of what he stands for," US Defence Secretary Ash Carter said on Monday.