A recent warming of ties between Saudi Arabia and Iraq could signal a move away from Iran's influence over Baghdad, analysts say, but with Prime Minister Haider al-Abadi arriving on Wednesday in Tehran, that remains to be seen.

On Sunday, Saudi Arabia and Iraq inaugurated a coordination committee and signed a number of agreements. The developments come after years of tension between Saudi Arabia and Iraq.

Al-Abadi visited Riyadh for the second time in four months, as part of a regional tour that also included stops in Egypt and Jordan.

In a statement addressing the inauguration of the committee, King Salman of Saudi Arabia said the body presents the two countries with a "historic opportunity to build an effective partnership to achieve common aspirations".

The coordination committee includes a range of political, security, economic, trade and development deals.

As part of the agreements, Saudi Arabia will open a consulate in Iraq, relaunch airline flights between the two countries, open the border, and jointly develop ports and highways.

The two nations also agreed to allow Saudi investment in Iraq, study a trade exchange area, and review customs cooperation agreements.

For his part, al-Abadi expressed his optimism and "deep satisfaction" with the recent developments between the neighbouring countries.

{articleGUID}

What has changed?

Since the fall of Iraqi President Saddam Hussein's government in 2003 during the US-led invasion, Iran has advanced its influence in Baghdad.

Iran has helped Iraq in the fight against ISIL (also known as ISIS) while supporting powerful Shia militias in the country.

The fallout in Saudi-Iraqi relations began after Iraq's invasion of Kuwait in 1990. Following the demise of Hussein's regime, incoming Prime Minister Nouri al-Maliki's administration in Baghdad did not offer much optimism to solve the myriad of post-war problems.

Since 1990, Saudi Arabia has had its embassy in Iraq shut down and borders closed.

However, the first signs of easing tensions between the two countries started in 2015 when Saudi Arabia reopened its embassy in Iraq.

In February, Adel al-Jubeir, the Saudi foreign minister, visited Baghdad marking the first visit by a Saudi foreign minister to the Iraqi capital in almost 27 years.

"Abadi's tenure has contrasted somewhat starkly with that of Maliki, who was a much more divisive figure, populist, and sectarian in his outlook and rhetoric," Ranj Alaaldin, a visiting fellow at Brookings Doha Center, told Al Jazeera.

"Since the arrival of Abadi, Iraq has been presented with an opportunity to open a new chapter with the region."

{articleGUID}

Iran challenged

With Iraqi elections coming up less than a year from now, Saudi Arabia is attempting to establish new alliances in Iraq to ensure its interests and relations with Baghdad remain secure, according to analysts.

One of the goals is to "sideline and challenge Iran's alliances in Baghdad", Alaaldin said.

"The US backs Abadi and sees him as a counterweight against Iran-alliances - including Maliki and Shia militia groups that aligned with Iran," he said.

Another common interest between Saudi Arabia and al-Abadi's government is to "reconstruct and rehabilitate Arab Sunni cities in northern Iraq - financially and politically", Alaaldin said, in order to enhance Arab-Sunni political participation with elections around the corner.

In July, Iraq's nationalist Shia leader Muqtada al-Sadr made a surprise visit to Saudi Arabia's Jeddah, where he met Crown Prince Mohammed bin Salman.

'Balanced approach'

How effective the Saudis can be in containing Iran's influence in Iraq remains unclear.

Marwan Kabalan, an associate political analyst at the Doha Institute, said it is unknown if the Saudis can succeed "given their poor foreign policy performance vis-a-vis Iran".

Al-Abadi will maintain a "balanced" approach in his regional relations, he said, with the Iraqi prime minister arriving in Tehran for talks on Thursday.

"[al-Abadi] would most probably assure the Iranians that his visit to Saudi Arabia is not against them," Kabalan told Al Jazeera.

"All he is trying to do is to invite much [needed] investment money to rebuild Iraq's destroyed cities, something the Iranians cannot offer. This is important especially for his Shia base of support, which is very sceptical about Saudi Arabia."