Ahmadinejad Official Website Han / EPA
Egyptian President Mohammed Morsi, right, greets Iranian President Ahmadinejad at the airport in Cairo, Egypt, Tuesday.
Published at 1:20 p.m. ET: CAIRO -- It’s being billed as a historic event, a thawing of icy relations between two regional heavyweights. Many in the West will regard Iranian President Mahmoud Ahmadinejad’s visit to Cairo as yet one more example of how Egypt has transformed from a staunch American ally to "not an ally or an enemy” as Barack Obama put it.
But it is actually more complex and nuanced than it might appear.
The two countries have been regional rivals since Egypt signed a peace treaty with Israel and Iran overthrew the Shah -- coincidentally is buried in Cairo -- and imposed an Islamic government after its revolution in 1979.
Ahmadinejad is there to attend the multi-nation summit of the Organization of Islamic Cooperation, so in a way the trip is no different than those he has made to the U.S. to attend the annual U.N. General Assembly meetings -- hardly a sign of warming relations between Tehran and Washington.
A trip to Tehran in August by the then newly-elected Egyptian President Mohammed Morsi was also to attend a multinational summit.
The countries have pledged further cooperation and they routinely condemn what they describe as Israeli aggression against Palestinians.
But there are more differences, both ideologically and politically, than similarities.
Egypt is now led by Islamist political parties from the Sunni branch of Islam, such as the Muslim Brotherhood, the ultra-conservative Nour party and more moderate ones like the Wasat party.
Iran, on the other hand, is an overwhelmingly Shiite Muslim country.
There are deep-rooted ideological differences that date back to the birth of Islam between Sunni and Shiite Muslims.
The theological differences are vast, and although they are often downplayed in the politically-correct world of diplomats and politicians, there is still a deep-seated mistrust between the two religious doctrines across the Arab world.
Iran is home to many Sunni Muslims who complain of discrimination at the hands of the Shiite government.
In Egypt, the Shiite minority complains of similar societal discrimination at the hands of the largely Sunni society.
Some of the hardline Sunni groups have called on the Egyptian government to prevent Ahmadinejad from visiting religious sites during his visit.
And, in addition to the religious differences, there is also a vast political gulf between Iran and Egypt that is not likely to be overcome anytime soon or lead to full political and diplomatic cooperation.
The starkest difference between the countries is in the ongoing war in Syria.
Egypt's Islamist government and the Muslim Brotherhood support the revolution against Syria’s President Bashar Assad.
The Syrian branch of the Muslim Brotherhood – which has been joined in its struggle to overthrow the Assad regime by more extremist Islamist groups -- is financed and armed by Sunni-Muslim countries including Turkey, Saudi Arabia and Qatar.
Meanwhile, Iran is a staunch supporter of the Syrian government. Iranian officials have publicly expressed support for Assad, meeting with him and providing his embattled regime and military with money, technical assistance and, according to some reports, weapons.
Another area where the two countries have been at odds is the Persian Gulf. Countries there have large Shiite Muslim populations that complain of discrimination and Iran has consistently tried to highlight the plight of Shiites living in the Gulf region.
They point to the hypocrisy of the international community in turning a blind eye to the uprising in Bahrain, where a Sunni monarch rules a country that is predominantly Shiite.
Egypt, meanwhile, is standing behind the Gulf states, which are providing financial assistance to its faltering economy.
Ed Giles / Getty Images Contributor
Ahmadinejad speaks to the media flanked by two Sheikhs of the Al Azhar mosque during a press conference in Cairo Tuesday.
'We do not agree'
All of these issues came to surface during Ahmadinejad's short visit to Cairo, some of it an embarrassingly public way.
He was greeted only briefly by Morsi and the two held a short meeting at the airport, but there are no scheduled bilateral meetings scheduled during the summit.
Ahmadinejad also paid a visit to Al Azhar, the academic center of the Sunni Islamic world, where he met the most senior scholars of Sunni Islam to discuss Syria, Bahrain and other issues.
At an awkward press conference, the deputy head of Al Azhar, Sheikh Hassan el Shifai, was highlighting points of agreement between them when Ahmadinejad abruptly interrupted to say, “we did not agree, we did not agree.”
Afterward, Ahmadinejad went to pray at one of Cairo's most sacred mosques, Al Hussien. As he left, group of Salafist Sunni Muslims protested his visit and one threw a shoe at him.
So, while this historic visit was marked with all of the politically polite pleasantries and formalities, it’s highly unlikely either leader will be back in Iran or Egypt anytime soon -- unless it’s another multinational summit few people care about.