Mr Ahmadinejad (left) said improving ties would help peace
Iranian President Mahmoud Ahmadinejad has inaugurated a project to boost Sri Lanka's oil refining capacity during a brief visit to the country.
Mr Ahmadinejad said boosting ties between Tehran and Colombo would help peace and stability in the region.
Iran is emerging as a major economic donor in Sri Lanka which is under pressure on human rights issues as war has resumed with the Tamil Tigers.
Mr Ahmadinejad held talks in Pakistan on Monday and is heading on to India.
Sri Lanka's government has hailed Mr Ahmadinejad's visit as cementing relations with Iran.
The capital is festooned with flags, and bill boards proclaiming "Traditional Asian Solidarity".
During his short visit President Ahmadinejad toured development projects which Iran is helping to fund.
He held talks with his counterpart, Mahinda Rajapaksa, and signed a number of economic accords.
"We are seeking justice and fair play in the world and Sri Lanka and Iran have agreed to co-operate in all spheres for the mutual benefit of each other," the Iranian president told reporters.
Iran has already agreed soft loans and grants of $1.9bn for a hydroelectric and irrigation scheme and to upgrade Sri Lanka's main oil refinery, as well as to buy Iranian oil.
Sri Lanka is heavily reliant on Iran for its supplies of crude.
China has also come forward with money for a new port and other projects.
The BBC's Roland Buerk in Colombo says Sri Lanka is slowly turning towards Asian countries which offer more donor money than traditional Western allies as well as less criticism over human rights.
Foreign Secretary Dr Palitha Kohona told the BBC: "Asians don't hector each other from public pulpits. They're more ready with assistance and less ready with gratuitous advice."
Our correspondent says Sri Lanka has come under pressure from some countries over its human rights record as war has resumed with Tamil Tiger rebels fighting for independence in the island's north and east.
In March a US state department report accused government forces and allied militias of unlawful killing, torture, hostage-taking and extortion with impunity.