He avoided directly naming the United States, which has 158,000 troops in Iraq.
US commanders have accused Iran of training and arming Shia fighters.
Iraqi government figures revealed at the weekend that for the first time in six months the Iraqi death toll from unrest rose in February. At least 23 people were killed in fresh attacks on Monday.
Ahmadinejad's call appeared to have been prompted by the warm reception he received from the Shia-led Iraqi government of Nuri al-Maliki, Iraq's prime minister.
Al-Maliki himself praised the role played by Tehran in Iraqi affairs.
"There was a high level of trust and I frankly say that the recent Iranian position towards Iraq is extremely helpful," he said on Sunday after talks with Ahmadinejad.
The Iranian leader said his visit had opened a "new page" in relations with Iraq.
"We have the same understanding of things and the two parties are determined to strengthen their political, economic and cultural co-operation," he said on Sunday after his arrival in Baghdad.
Iran's relations with Iraq have improved under the new Shia-led government installed after the US-led invasion of Iraq in 2003.
Many leading Iraqi politicians were former dissidents who found sanctuary in Iran when Iraq was ruled by Saddam Hussein, the country's former president.
On Sunday, Ahmadinejad blamed Washington for bringing "terrorism" to the Middle East.
"Six years ago there was no terrorism in our region. As soon as strangers set their foot in the region, the terrorists came here," he said.
A day earlier, George Bush, the US president, accused Iran of fomenting violence in Iraq and called on it to "stop sending in sophisticated equipment that's killing our citizens".
Ahmadinejad's visit to Iraq is the first ever by an Iranian president since the end of the bloody war in the 1980s between the two coutnries that left one million people dead.