Relations further deteriorated after Egypt's peace treaty with Israel.
"For the first time, we are witnessing breaking of ice between the two countries," said political analyst Rafaat Sayed Ahmed.
Ultraconservative Islamists known as Salafis, who view Morsi as too pragmatic and compromising but ally with him in the face of secular opposition, see Iran as Sunni Islam's greatest enemy. Salafi clerics often rail against Shiites and Iran in their sermons.
On Tuesday, Egypt's hard-line Daawa Salafiya, which is the foundation of the main Salafi political party Al-Nour, released a statement calling on Morsi to confront Ahmadinejad on Tehran's support for the Syrian regime and make clear that "Egypt is committed to the protection of all Sunni nations."
Egypt-Iran diplomatic overtures have raised concerns among Sunni Gulf nations, who are keeping a close eye on the Iranian leader's visit. The Gulf states accuse Iran of supporting Shiite minorities in the Gulf and harbor concerns about Tehran's disputed nuclear program.
Gulf countries, especially the United Arab Emirates, have made little effort to hide their enmity to the new Egyptian government out of fear the Islamists will export Egypt's revolution to their countries. The UAE has cracked down on Egyptian expatriates for links to Morsi's fundamentalist Muslim Brotherhood and has given refuge to former Egyptian regime members.
Morsi and the Brotherhood have sought to ease Gulf concerns, stressing that the security of the Gulf nations — which Egypt has relied upon for financial aid to help prop up its faltering economy — is directly linked to Cairo's own.
Foreign Minister Mohammed Amr Kamel reiterated that on Tuesday, saying "Egypt's relationship with Iran will never come at the expense of Gulf nations."
Morsi's government has presented the moves to improve ties as a policy of greater independence from the United States. He may also have geopolitical considerations: Gulf powerhouses Saudi Arabia and the United Arab Emirates are cool to Morsi's Muslim Brotherhood and his rule, and several experts said Morsi wants to keep the option of ties with Iran open as an alternative.
"Now relations with Gulf Countries are not that good. You need to make some balance and to play with all the cards you have," Egypt's former ambassador to Syria, Mahmoud Shukri, told The Associated Press.
Still, he and others said they don't expect normal relations to be restored between the two countries. "This phase is to open channels and have dialogue," Shukri said.
Morsi is also reluctant to alienate the United States, whose help Egypt is hoping for in rescuing its faltering economy, or to hurt ties with Israel, with which his government has maintained cooperation despite the Brotherhood's deep enmity to the Jewish state.
"I don't see that Egypt will make a decision separate from the course of its relationship with the U.S. and Israel, for whom Iran is now the main issue," said Mohammed Abbas Nagi, an Egyptian expert on Iran.
The Syria issue is also a complication. While Iran staunchly backs Assad's bloody suppression of the revolt, Cairo is home to the offices of the main Syrian opposition council, in which the Brotherhood's Syrian branch has a strong presence.
"The thorny issue here is Syria," said Ahmed, the political analyst. "Egypt can play a role when it stops talking about the downfall of the Syria regime, and take a step forward to host talks between the regime and the opposition."
Egypt's leader has spearheaded an "Islamic quartet" of nations to try to resolve the Syrian crisis. The grouping includes Iran, as well as Turkey and Saudi Arabia, which are two of the most vocal critics of the Syrian president.
Associated Press writer Aya Batrawy and Amir Makar contributed to this report.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.