President Mahmoud Ahmadinejad on Tuesday became the first Iranian leader to visit Egypt since the 1970s, the latest sign of the thawing of relations between the rival Muslim nations.
Ahmadinejad received a red-carpet welcome as Egypt's President Mohammed Morsi greeted him on the tarmac at Cairo International Airport with a kiss on each cheek.
Under Egypt's former leader, Hosni Mubarak, a visit like this would never have happened.
Egypt is a leading Sunni Muslim nation, while Iran is the most influential Shiite Muslim country. In addition to this sectarian rivalry, the contentious relationship dates to several episodes in the late 1970s and early 1980s.
Iran sought to ostracize Egypt after it signed a peace treaty with Israel in 1979. Egypt then supported a fellow Arab nation, Iraq, during its eight-year war with Iran from 1980 to 1988.
In addition, Egypt welcomed the Shah of Iran after he fled amid the Iranian Revolution in 1979.
Relations fell to such a low level that the Iranian government named a Tehran street after the Egyptian soldier who assassinated Egyptian President Anwar Sadat in 1981.
A Reciprocal Visit
Ahmadinejad's visit comes a few months after Morsi made a trip to Tehran. While in the Iranian capital, however, Morsi publicly urged the Iranians to stop supporting the embattled Syrian regime in its war against rebel forces.
While Ahmadinejad's visit to Egypt is a major milestone, observers say a flourishing relationship between Iran and Egypt remains unlikely.
"I think it's important to think about the regional climate," says Michael Wahid Hanna of the Century Foundation. "We have a raging civil war in Syria that has sectarian dimensions that is at the moment a huge hurdle to improving Egyptian-Iranian ties."
Hanna adds that the relationship between the two nations is further limited by Egyptian fears that Shiite-led Iran is seeking regional hegemony. The overwhelming majority of Egypt's Muslims are Sunni.
Tensions were on display during the first day of Ahmadinejad's visit.
He met briefly with Morsi and then with Grand Sheik Ahmed al-Tayeb, the head of Al-Azhar, the highest institute of Islamic learning in Egypt.
In a press conference that followed, the adviser to the sheik slammed Iran for its support of Syria's regime, and also criticized Iran for its treatment of Sunni Muslims in Iran.
Ahmadinejad stood nearby and squirmed, visibly uncomfortable.
Further complicating the relationship are Egypt's Arab allies in the Persian Gulf region, which view Iran with hostility.
"Egypt is reliant on the Gulf now for much-needed financial and economic assistance," says Hanna, of the Century Foundation. "And I think their views, which are obviously quite hostile to Iran, will be an important factor for Egypt's new rulers in terms of thinking about how they're going to reestablish ties with Iran."
Despite the criticism, senior members of Egypt's powerful Muslim Brotherhood said that forging a relationship with Iran is in the interests of Egypt and the region, even if the countries have their differences.