BAGHDADinfo-icon: Iraninfo-icon's President Hassan Rouhani hit back on Monday against pressure from the "aggressor" United Statesinfo-icon on Iraqinfo-icon to limit ties with its neighbour, during his first official visit to Baghdad.

Shiainfo-icon-majority Iraq is walking a fine line to maintain good relations with its key partners Iran and the United States which themselves are arch-foes.

It has been under pressure from Washington not to get too close to the Islamic republic next door, particularly after the United States last year withdrew from the 2015 nuclear deal with Iran and hit Tehraninfo-icon with sanctions.

Baghdad was given limited waivers to continue buying electricity and natural gas from Iran, but Washington has urged Iraq to partner with USinfo-icon companies to become energy independent.

Rouhani, who is on his first trip to Iraq since becoming president in 2013, hailed his country's "special" ties with its neighbour. These relations could not be compared to Iraq's ties "with an aggressor country like Americainfo-icon", he said before flying to Baghdad for the three-day visit.

"America is despised in the region. The bombs that the Americans dropped on Iraqis, Syrian people and other countries cannot be forgotten," he added. Iran is always ready to help its neighbours, he said, in a nod to the role Tehran played to help Iraq battle the militant Islamic Stateinfo-icon group.

Iraq's President Barham Saleh, at a joint news conference with Rouhani in Baghdad, thanked Iran for its "support" and said he was "lucky" to have it as a neighbour, without making any reference to the US.

Rouhani, who is heading a large political and economic delegation, said relations between the two countries should be further "reinforced and developed".

The Iranian president later had a meeting with Prime Minister Adel Abdel Mahdi, during which he highlighted the political, trade and energy links between the two neighbours.

After Turkeyinfo-icon, Iran is the top supplier of imported goods to Iraq, including cars, gas, home appliances and vegetables.

Iran was the first country to respond to Iraqi calls for help after IS jihadists in June 2014 captured the main northern city of Mosulinfo-icon as they threatened to overrun the capital Baghdad and the oilinfo-icon-rich region of Kirkuk.

It dispatched "military advisers" and equipment along with the famous Revolutionary Guards elite Quds Force commander General Qassem Soleimani.

Rouhani said Iran has supported the Iraqi people "during difficult times" and would continue to back them "through times of peace and security".

Relations between the two countries were not always close -- they fought a bloody warinfo-icon from 1980 to 1988. Tehran's influence in Baghdad grew after the 2003 US-led invasion of Iraq toppled the government of Saddam Hussein. Iran now has significant leverage over Iraq's Shiite political groups.

Rouhani is also set to meet Iraq's chief Shia cleric Grand Ayatollah Ali Sistani, who is revered by many Iranians.

The meeting in Najaf will be the first between the top cleric and an Iranian president. In 2013 the grand ayatollah refused to receive Rouhani's controversial predecessor Mahmoud Ahmadinejad.

Analysts say talks between Sistani and Rouhani are aimed at bolstering the ranks of Shia Muslims in the face of Iraq's warming ties with Iran's Sunni-ruled rival Saudi Arabiainfo-icon.

The meeting could "prevent Saudi Arabia and its allies from sowing discord" between Iran and Iraq, a Shia cleric from the Iranian holy city of Qom was recently quoted as saying in Iran's Ebtekar newspaper.

Saudi Arabia is keen to develop relations with Baghdad to counter the influence of Iran in Iraq, which is seeking economic benefits to rebuild after the defeat of IS.

Iraqi political analyst Hisham al-Hashemi said Rouhani is seeking to bolster trade with Baghdad and discuss ways "to circumvent US sanctions".