The official IRNA news agency said Ahmadinejad spoke with Iraqi Prime Minister Nouri Al-Maliki and President Jalal Talabani by telephone to congratulate them on the agreement Iraqi lawmakers reached this week that brings all of Iraq’s major political blocs into a new government led by Al-Maliki.

IRNA said Ahmadinejad told Talabani that the formation of a new government “is a great victory for the Iraqi people.” In a separate telephone conservation with Al-Maliki, the Iranian president said Tehran “is ready for cooperation and the expansion of relations with its friendly neighbor.” Iran plays a critical role in Iraqi affairs and has the power to sway political fortunes in its neighbor through its deep ties to Iraq’s major Shiite factions, which have dominated the government and security forces since the US-led invasion toppled Iran’s arch foe Saddam Hussein in 2003.

The power-sharing deal in Iraq announced on Wednesday ended an eight-month impasse that had stalled the formation of a new government and threatened to re-ignite sectarian violence.

Under the agreement, Al-Maliki got the prime minister’s job, Jalal Talabani, a Kurd, returned as president, and the Sunni-backed Iraqiya block got the parliament speaker’s post. Iraqiya is also supposed to head a council intended to serve as a check on Al-Maliki’s powers. That job is supposed to go to the head of Iraqiya, Ayad Allawi.

Talabani has nominated Al-Maliki to form the new government. Al-Maliki now has a month to allocate ministerial posts.