Instead, he has forged a postelection coalition with a rival Shiite bloc that includes some of the most powerful militias operating in Iraq — groups that get their funding and support from Tehran.

The deal underscores the active role Iran is taking in shaping the next government of Iraq, sending key military and spiritual advisers to revive a grand coalition of Shiite parties as a conduit for its influence in Baghdad. It also illustrates how Iran has gained sway over al-Sadr, who once called for booting foreign influence from Iraq.

Two Shiite politicians with inside knowledge of the party talks told The Associated Press that the new coalition between al-Sadr’s Sa’eroun bloc and Hadi al-Amiri’s Fatah bloc came on the heels of intensive Iranian lobbying, including visits by the influential Gen. Qassem Soleimani and the highly respected son of Iran’s Supreme Leader Ayatollah Ali Khamenei, who met with al-Sadr earlier this month.