On the occasion of his historic visit to Egypt, Iranian President Mahmoud Ahmadinejad put on a full-scale charm offensive.

He gave an exclusive interview to al-Ahram, the establishment, state-owned newspaper, which ran it prominently today on the front page.

On the day he arrived, the president of the region's largest Shia regime, made a once improbable visit to al Azhar, the mosque and school at the heart of Sunni Islam's highest authority, to meet with — and be lectured by — its top scholar.

He later appeared, grinning widely, blowing kisses, waving at and jostling through the crowds. (Though the local press also captured some protesters making obscene gestures and kicking at his car as his convoy zipped by.)

Later, he visited the famous al Hussein mosque, which Shia muslims believe houses the head of the grandson of Prophet Mohammed. And there was word he planned to also go see the Great Pyramids.

Nearing the end of the high-profile role that's kept him in international headlines for eight years, Ahmadinejad's expedition to Egypt is a calculated high point.

For those who put much store in these things, he will forever be the Iranian president who bridged 35 years of acrimony and reached across from Tehran to Cairo, to try to build a new kind of relationship between two regional heavyweights, a constant theme in his pre-visit interviews.

Everything seems to be aimed at giving maximum exposure to what is not only an attempt to woo Egypt, but anyone in the Arab world who would listen.

And in between the official appearances and all the glad-handing, there also seems to be an avid search for some kind of Arab world legacy.

Fellow revolutionaries?

Over the past eight years in the Arab world, Ahmadinejad has been hailed, denounced and everything in between.

Most recently, the majority Sunni Arab population's opinion has soured over Iran's insistence on backing Syria's hard-line regime against its largely Sunni Syrian population.

Add that to the international sanctions that Iran is facing over its nuclear ambitions, and the cold war with neighbouring Gulf Arab nations. Under Ahmadinejad, Iran has been a pretty isolated place.

But Egypt's revolution — and the replacement of the staunchly Western Hosni Mubarak with the Muslim Brotherhood's Mohammed Morsi — opened the door to a possible new alliance.

"Iran views the Arab Spring as part of a major Islamic revolution in the Iranian or the Khomeini model," says Hala Mostafa, an Egyptian political analyst.

"That's why it's very important to Iran to get close to Egypt, as one of the major regional powers and as one of the major actors in the Arab Spring."

The relationship between the two countries began to break down following Iran's revolution in 1979, and Egypt's subsequent decision to sign a peace deal with Israel — Iran's and Ahmadinejad's arch enemy.

Today, Ahmadinejad, and Morsi too, see more commonalities than differences. But there is much standing in the way of healing the rift entirely.

Sunnis and Shias

Ahmadinejad's visit to al Azhar served to highlight one of those obstacles: the entrenched distrust between Sunni and Shia Islam.

At the end of his meeting with al Azhar's Grand Sheik Ahmed Al-Tayeb, Ahmadinejad said they shared similar ideas.

Yet the cleric had rebuked the Iranian president for meddling in the affairs of Gulf Arab countries, and for trying to extend Shia Islam's reach.

For Egypt's new Islamist regime, dependence on those Sunni Gulf states (not to mention the U.S.), which are similarly suspicious of Iran, also means keeping Tehran at a distance.

"The security of the Gulf states is the security of Egypt," Egyptian Foreign Minister Mohamed Kamel Amr said, according to the official MENA news agency, in what was widely perceived as a don't-worry signal to supportive Arab nations.

The matter of Syria is also divisive. Iran backs the repressive regime of Bashar al-Assad, while Morsi, and most Egyptians, side with their Sunni co-religionists among the population. Remember, Egypt went through its own revolution, beginning two years ago, and there's a great deal of empathy for Syrians as theirs gets bloodier than anyone imagined.

Also remember, and Egyptians know this, too, that Ahmadinejad leads a terrible police state, which not only routinely violates the human rights of its citizens, but in 2009, brutally shut down its people's own attempt at revolution.

So it was no shock that along with the kisses that greeted Ahmadinejad at the airport, there would also be a few hiccups.

For the Iranian leader, the rebuke from al Azhar was certainly an unwelcome surprise.

A Turkish news agency also captured footage of a Syrian man attempting to hit Ahmadinejad with a shoe — one of the ultimate insults in the Middle East (and most famously meted out against George W. Bush in Baghdad some years ago, to the general applause of many in the region).

All in all, not the unqualified welcome Ahmadinejad might have hoped for.

Restoring full diplomatic ties with Egypt would be quite a coup for Iran in these difficult political times. But it is highly unlikely given the climate.

Ahmadinejad will have to live with having made some regional history while trying.