At the end of July thousands of locals took to the streets of Baghdad to protest against the lack of state services—and especially the breakdown in electricity supply, which was making their lives very difficult in summer temperatures over 50 degrees Celsius (over 122 Fahrenheit).

Most of the organisers of these demonstrations were civil society activists and other prominent local personalities and their aims were clearly stated. They wanted the Ministry of Electricity reformed and an end to corruption there.

The demonstrations took place peacefully and there were no clashes with police or military on site; these forces actually distributed water bottles to the demonstrators.

Two days after the first demonstrations, Qais al-Khazali, head of the League of the Righteous militia group, appeared on television proclaiming his support of the demonstrators. The League of the Righteous is one of a dozen or so unofficial armed groups, made up mostly of local Shiite Muslims, that have played an essential role in fighting against the extremist Islamic State group in Iraq. However the League of the Righteous is also known as one of the more extreme of these groups. And most recently the militia has also become known for its support of, and patronage from, former Iraqi Prime Minister, Nouri al-Maliki.

On television, al-Khazali announced the creation of civilian units associated with the Shiite Muslim militias. “The demonstrators should set firm goals,” al-Khazali said, “because the problems in Iraq are not only about the Ministry of Electricity. The problems are part of the whole political system.”

Once again al-Khazali then recommended that Iraq's political system be changed from a parliamentary one to a presidential one. This would in effect give al-Maliki, one of the League of the Righteous' sponsors, more power again; al-Maliki tried to hang onto power after the last elections but was denied by other Iraqi politicians and he has been seen as trying to undermine his successor, current Prime Minister Haider al-Abadi, ever since.

Some of the civil society activists who had first organised the popular protests in Baghdad were upset at al-Khazali's statements. They felt he was trying to hijack the protests to push his own agenda and as a result, some said they would boycott the next lot of protests.

Three days before the second demonstration, which was to take place on August 7, supporters of the League of Righteous in Baghdad began to prepare to take part in the protests.

“A formal letter from the League’s head office was sent to all of our offices,” Karim al-Lami, one of the militia's members based in the Sadr City neighbourhood in Baghdad, told NIQASH by phone. “The letters emphasised the importance of all members and employees participating. Additionally, al-Lami explains, the letter said that militia members shouldn't carry banners or clothing or badges that indicated they were militia members. “They should only use anti-government and anti-Parliament slogans and condemn the poor services,” al-Lami says.

Another militia, the Hezbollah Brigades, said they also supported the protests. The leader of another major Shiite Muslim militia, the Badr Brigades, said that while he supported the demonstrations he was too busy fighting the Islamic State, or IS, group to join in. In an official statement, Hadi al-Ameri stressed the importance of fighting the IS group, “because they are still threatening Baghdad”.

The fact that the Shiite Muslim militias – which have been gaining in political influence thanks to their high profile in the fight against the IS group; they're widely seen as heroes among the Shiite majority population – appeared to be planning to hijack the anti-government protests did not go unnoticed at the highest levels in Baghdad.

Senior sources close to Prime Minister Haider al-Abadi say that al-Abadi held a number of discussions on the subject in the week between the two protests; the sources requested anonymity because they were not supposed to speak to media. During meetings al-Abadi said he felt that the militias were trying to use the protests as a way to topple, or at the very least unbalance, his government, the sources say.

The same senior politicians told NIQASH that several weeks ago al-Abadi had gone to the country's highest Shiite Muslim cleric, the Grand Ayatollah Ali al-Sistani, with his problems. Al-Abadi complained to al-Sistani that he was under attack by factions from within the Shiite landscape, including some of the Shiite militias, and that he was powerless against them because they had close ties to neighbouring Iran.

In terms of religion, many members of these militias pledge allegiance to Iran's senior spiritual leader, the Grand Ayatollah Ali Khamenei, rather than al-Sistani.Khamenei has a very different leadership style to al-Sistani's. And the militia members often carry posters with Khamenei's face on; it is generally thought they get a lot of their weapons and funding from Iran too.

Al-Sistani is the revered spiritual leader of millions of Shiite Muslims across the globe and he does not make it a habit to get involved in Iraqi politics. In fact, the cleric has made many pronouncements over the years about how clerics should not interfere in politics and until relatively recently, he has deliberately not favoured any one politician over others. However this has changed since the IS group came along and Iraq seemed on the brink of falling into political crisis and violent conflict.

During the conversation between al-Sistani and Prime Minister al-Abadi, the senior cleric apparently criticized al-Abadi for slow progress during the past year that he has been in office and he also expressed deep concern about the growing divide in Iraqi society between different religious and ethnic groups, most conspicuously between Sunni Muslims, Shiite Muslims and Iraq's Kurdish ethnic group. Al-Sistani warned al-Abadi against going down the same path that former Prime Minister al-Maliki had, which only deepened those divisions and sparked the current security crisis.

The sources close to al-Abadi told NIQASH that after the first set of protests, there were more intense conversations between al-Sistani and al-Abadi. In the early hours of last Friday, August 7, shortly before the second demonstration was to begin, there were apparently hours-long conversations between the two parties.

The Prime Minister’s office refused to comment to NIQASH about these conversations. However in a report by Iraqi daily, Al Mada, an MP from the State of Law coalition to which al-Abadi also belongs, confirmed that there had been conversations between the religious body and the Prime Minister’s office. During the conversations, it was agreed that al-Abadi would set up a small committee to look into government reforms, MP Jassim Mohammed Jaafar, told the newspaper.

Other clerics in Najaf, with political affiliations but also close to al-Sistani's office, say that during the talks, two main issues were discussed. The clerics, who had to remain anonymous because they were not authorised to speak to media, say that the first subject revolved around a plan, suggested by al-Sistani, for reform of the current government and the second topic was all about how to prevent the militias hijacking the popular protests and using them against the al-Abadi government.

At midday that same day, during Friday prayers in Karbala, Ahmad al-Safi – one of only two clerics with permission to state al-Sistani's political position – declared that al-Sistani supported al-Abadi's government.

“Al-Abadi shouldn't hesitate to dismiss any person who isn't in the right position, even if different political blocs disagree,” al-Safi said. “Partisan and sectarian quotas should be abolished ... and all Iraqis should support and help the government,” he continued. “Al-Abadi should use an iron fist with anyone who tampers with the Iraqi people's money and he should cancel privileges and large financial allocations that belong to current and former state officials.”

Even while al-Safi was reading out that statement on behalf of al-Sistani, members of groups affiliated with the Shiite militias were putting up posters and placards in Baghdad's Tahrir Square, where that afternoon's demonstration was planned. Some of the posters were highly critical of the civilian activists who had first organised the demonstrations, saying that they were former members of deposed leader Saddam Hussein's Baath party trying to seize power in Iraq, and that they were opposed to Islam.

One hour after al-Safi's announcement in Karbala, came a reply from the Prime Minister’s office in Baghdad: al-Abadi pledged to abide by al-Sistani's commandments and to come up with a list of government reforms. “I declare my total commitment to the directions of the religious [Shia religious leadership], which has voiced the concerns and aspirations of the Iraqi people,” al-Abadi's statement said.

By 6pm on Friday, the protests were in full swing and were even bigger than the preceding week's. Strangely though, during this demonstration, a large number of protestors actually boasted slogans that expressed support for al-Abadi and al-Sistani. Many locals were surprised at this.

On Sunday morning – the first day of the working week in Iraq – al-Abadi turned up with more surprises: A manifesto for drastic reform of the government. This included a number of far-reaching and very significant changes.

As the New York Times reported: “The measures ... promise to save money and fight corruption by cutting expensive perks for officials. Most notably, they eliminate three deputy prime minister posts and three vice presidencies, including the one held by former Prime Minister Nouri al-Maliki, who was a rival of Mr Abadi”.

Al-Abadi also promised to reduce the large security retinues senior government officials have and send members of these to fight against the IS group as well as ensuring that senior officials in independent bodies were chosen on merit rather than based on sectarian or ethnic quotas. The full text of al-Abadi's ambitious manifesto can be found here.

Other parliamentarians told the Al Mada newspaper they thought that the cuts would result in an extra IQD40 billion (US$30.5 million) going back into Iraq's budget.

By Sunday evening there were demonstrators in Tahrir Square, Baghdad, again. But this time the protestors were raising banners and shouting slogans in support of al-Abadi and al-Sistani. Voices belonging to members and supporters of the Shiite Muslim militias seemed to have been muted this time in Tahrir Square.

The general opinion among the protestors was that al-Sistani had helped to save al-Abadi and his government by changing the political direction of the demonstrations. Many also felt that al-Sistani had also saved Iraq from Iranian influence, in the form of the Shiite Muslim militias.

Why would al-Sistani, who is usually incredibly reluctant to get political, do this? And why now? Some have suggested the competition between Iraqi and Iranian Shiite religious establishments is to blame. Other more cynical observers point out that while al-Sistani's moves certainly helped defuse a potentially explosive, political situation, the religious leader is really only a hero for the country's Shiites - he doesn't care as much about other sects or ethnic groups in Iraq - and his only motivation is to ensure the safety of his followers.

Iraqi analyst, Hayder al-Khoie, an associate fellow at Chatham House, a London-based think tank, who specialises in Iraqi affairs and Shia clerical authority, says that in the past, al-Sistani has only gotten involved in politics when he feels events could have a major impact on Iraq's future.

For example, al-Khoie writes in an emailed interview, “after the spectacular collapse of the armed forces [after attacks by the IS group last year] he believed he had no choice but to issue calls to Iraqi citizens to defend their country from this existential threat. Many in Iraq are drawing parallels with that fatwa and [al-Sistani's] strong push for reform. It's clear that Ayatollah Sistani believes that Iraq is yet again at another critical juncture and, following growing demands from protesters, he felt he had to act to steer the country away from more chaos,” al-Khoei explains.

The message from the Marja'iyya – the Arabic term for the collective Shiite spiritual leadership – was seen by some as a kind of criticism of al-Abadi but in fact, it was also a message of support, al-Khoei points out.

“It was just as much a message to al-Abadi's rivals and partners not to stand in the way of change and reform,” the researcher notes.

Although, in an unusual show of unity, the Iraqi Parliament passed the proposed reforms this week, it remains unclear as to whether al-Abadi's measures will be able to be carried out. There are still demonstrations happening in Baghdad and elsewhere that could be hijacked by those with other agendas and there's no doubt ranking political players will oppose any loss of privileges, influence and income.

However, as al-Khoei and others note, al-Sistani's support is incredibly important.

“With al-Sistani's call and the popular protests, al-Abadi [was] transformed from a handicapped Prime Minister to almost having a free hand to push much-needed reforms,” he says. “Abadi has a clear mandate now. And I think that's exactly what Sistani wanted: To give him the political space he desperately needed to combat systematic corruption and waste.”