Iranian President Hassan Rouhani was in Baghdad on Monday, making his first official visit to the nation that Tehran once fought a bloody war against and later backed in the battle with the Islamic State group.
Since Mr. Rouhani's election in 2013, Iraq has relied on Iranian paramilitary support to fight ISIS, following the militant group's capture of the Iraqi city of Mosul and other territory in both Iraq and Syria.
Now with the militants facing a final territorial defeat in the Syrian village of Baghouz, Iran is looking for Iraq's continued support as it faces a maximalist pressure campaign by President Donald Trump after his decision to withdraw the United States from Tehran's nuclear deal with world powers.
Mr. Rouhani, who is accompanied on the three-day visit by a high-ranking political and economic delegation, was received by an honor guard on landing in Baghdad, where he was welcomed by Iraqi Foreign Minister Mohammed Ali Al-Hakim.
Mr. Rouhani then visited the shrine of Imam Kadhim, the seventh of 12 clerics revered by Shiites worldwide. Mr. Rouhani, a Shiite cleric himself, paused to reach out and touch the gate surrounding the imam's tomb.
He then met President Barham Salih and spoke to journalists, telling them that a "stable Iraq will lead to stability in the entire region."
"We want to be united countries, not against others, but attracting others to our unity," Mr. Rouhani said.
For his part, Mr. Salih said Baghdad's central location made it crucial to resolving regional issues. He thanked Iran for its support during Iraq's fight against ISIS.
"The victory that was achieved against [ISIS] group in Iraq was an important and huge victory, but incomplete as the eradication of that sick, deviated line of thought and extremism require more sustainable regional efforts and cooperation," Mr. Salih said.
Mr. Rouhani was to later meet Prime Minister Abel Abdul-Mehdi. He plans on meeting with other politicians and Shiite leaders during his visit.
Mr. Rouhani's visit underscores how much has changed since the 1980s, when Iraqi dictator Saddam Hussein invaded Iran, sparking an eight-year war that killed an estimated 1 million people. After the 2003 U.S.-led invasion of Iraq toppled Saddam, Iran began a campaign of backing militants who targeted American forces in Iraq.
Tehran also made political connections with Iraq's Shiite leaders, who had been persecuted by Saddam's government. Iran's former hard-line President Mahmoud Ahmadinejad became the first Iranian president to visit Iraq on a trip in 2008.
Iraq and Iran share a 870-mile-long border. Mr. Trump made a snap December trip to Iraq and made comments that U.S. forces should stay in Iraq to keep an eye on Iran, something dismissed by both Iran and Iraqi leaders, whom Mr. Trump did not meet on the visit.
Speaking at Tehran's Mehrabad Airport before leaving for Iraq, Mr. Rouhani's official website quoted him as saying the trip's goal was "deepening bilateral relations."
"Relations between Iran and Iraq are special," Mr. Rouhani was quoted as saying. "In the recent years, the people of Iran have passed a test with pride, and that is wherever the peoples of the region faced a problem and asked for the help of the Iranian nation and government, we rushed to help them."
Mr. Rouhani, who had visited Iraq privately before becoming president, had planned an official visit in 2016 but it was cancelled over unspecified "executive" problems.
This time, Mr. Rouhani, who is on a second four-year-term, is particularly vulnerable because of the economic crisis assailing the Iranian rial, which has hurt ordinary Iranians and emboldened critics to openly call for the president's ouster.
Tehran sees the U.S. military presence at its doorstep in Iraq as a threat – one that could also undermine Iran's influence over Baghdad.
Iranian Foreign Minister Mohammad Javad Zarif alluded to that on Sunday while in Baghdad, saying that any country which tries to interfere with the good Iran-Iraq relations would "be deprived of opportunities for itself."
Iran also sees Iraq as a possible route to bypass U.S. sanctions that Mr. Trump re-imposed last year after pulling the U.S. out of the 2015 nuclear deal.
Last year, Iran's exports to Iraq amounted to nearly $9 billion. Tehran hopes to increase the roughly $13 billion volume in trade between the two neighboring countries to $20 billion. Also, some 5 million religious tourists bring in nearly $5 billion a year as Iraqis and Iranians visit Shiite holy sites in the two countries.
"This visit seeks to send a message to the United States of America that Iran is still effective in Iraqi politics," said Ali Fadlallah, an analyst in Iraq. "I think the visit [also] aims at settling the trade and economic relation. Iran wants to be partner in building up the infrastructure and the cities that were damaged by the war on terrorism."
This story was reported by The Associated Press with contributions from Nasser Karimi in Tehran, Iran.