Sistani famously called Iraqis to arms against the Islamic State group in 2014, giving rise to the Hashd al-Shaabi paramilitary alliance, which includes Iran-backed Shiite groups.
Those forces have since been placed under the command of regular Iraqi forces and several former fighters are now members of the Iraqi parliament.
Sistani rejects foreign influence in Iraq.
Iran and Iraq fought a devastating eight-year war in the 1980s but their relations shifted drastically with the American-led overthrow of Sunni Iraqi dictator Saddam Hussein in 2003.
Iran, which like its neighbour has a mainly Shia population, is now one of oil-rich Iraq’s main trading partners and has close ties to many of its political actors.
Shia-majority Iraq is walking a fine line to maintain good relations with Iran and its other key ally, the United States, an arch-foe of Iran.
Both have played a major role in the battle against IS jihadists.
Sistani, a spiritual leader to most of Iraq’s Shias and some in Iran, heads the religious establishment of Najaf, a Shia holy city in Iraq that rivals Iran’s Qom.
In 2013, the octogenarian leader refused to meet then-president of Iran, Mahmoud Ahmadinejad.
Rouhani, who is on his first trip to Iraq since becoming president in 2013, hailed his country’s “special” ties with its neighbour, saying they could not be prepared to relations “with an aggressor country like America”.