Iraqi leader Nouri al-Maliki announced on Thursday that he is dropping his bid for a third term as prime minister and pledged support for his replacement, Haider al-Abadi. (Reuters)

Iraq’s highest Shiite cleric on Friday welcomed outgoing Prime Minister Nouri al-Maliki’s decision to step aside and called on the country’s political factions to unite behind the new nominee for the premiership.

Grand Ayatollah Ali Sistani spoke a day after Maliki agreed to forgo a protracted legal battle with his rival, Haider al-Abadi, allowing for the formation of a new government that Sistani said would be able to “fix mistakes.”

The reclusive octogenarian cleric has been the key force behind the upcoming change of leadership in Iraq, where the extremist militant group known as the Islamic State is wreaking havoc. A source of religious guidance for millions in the majority-Shiite country, he wields unrivaled influence.

Sistani used his pointed Friday sermons, as well as a direct letter to Maliki’s party, to turn the tide of support for the man who has led the country for eight years. Maliki is widely blamed for isolating Iraq’s minority Sunnis, thereby bolstering support for the extremists.

Iraq should take advantage of the broad welcome for Abadi, internationally and domestically, Sistani said, according to comments during Friday prayers in the Shiite holy city of Najaf that were relayed by his representative.

Shiite tribal fighters carry a poster of Shiite spiritual leader Grand Ayatollah Ali al-Sistani. He urged unity during a sermon in the holy Shiite city of Najaf. (Nabil Al-Jurani/AP)

After the British-educated Shiite politician was nominated for the prime minister’s post Monday, the United States, Iran and Saudi Arabia endorsed him.

“Major mistakes” in the running of the army and in politics made a change of leadership necessary, Sistani said. As the Islamic State swept down on Mosul in June, divisions of the Iraqi army collapsed, and Iraq’s security forces have since relied heavily on Shiite militias to repel the militants’ advance.

Sistani said corruption must be addressed to avoid such mistakes in the future, and he urged the security forces not to raise flags other than the national flag.

Despite the broad range of professed support, Abadi will face major challenges in forming a government, analysts say. He has 30 days to do so, a deadline Sistani urged him to stick by.

It is hoped that a more inclusive government may be able to peel away support for Sunni extremists and prevent the Kurds from seeking independence. However, for Abadi, a Shiite closely associated with Maliki, winning Sunni support may be a challenge. On Thursday, groups affiliated with the Naqshbandi Army, violent supporters of former president Saddam Hussein’s Sunni regime, rejected any government formed by Abadi.

Mustafa Salim in Baghdad contributed to this report.