Rouhani told visiting Iraqi Prime Minister Heidar al-Abadi that Iran "will remain on the path until the last day," according to a report by the official IRNA news agency.
Rouhani says Iran will continue to provide Baghdad with military advisers and weapons. He also criticised the US for allegedly failing to sufficiently support Iraq against an escalating Sunni insurgency.
That insurgency continued its wave of attacks today as a string of bombings in and near Baghdad killed 26 people.
Earlier, a bomb struck at an outdoor market in the southern district of Abu Dashir, a mostly Shiite neighbourhood, killing four people and wounding nine, police officials said.
A little bit later, a bomb that went off near a small restaurant in central Baghdad killed five people and wounded 12, the officials said. Another bomb exploded at a commercial street in the town of Madian, just south of Baghdad, killing two people and wounding four.
No one immediately claimed responsibility for the latest attacks but they bore the hallmarks of the al-Qaida-breakaway Islamic State group which has captured large chunks of territory in western and northern Iraq, plunging the country into its worst crisis since US troops left at the end of 2011.
Yesterday, militants unleashed a wave of deadly attacks on Iraq's majority Shiite community, killing at least 43 people.
In the Shiite holy city of Karbala home to the tombs of two revered Shiite imams and the site of year-round pilgrimages four separate car bombs went off simultaneously, killing at least 26 people.
