CAIRO (Reuters) - Mahmoud Ahmadinejad arrived in Egypt on Tuesday on the first trip by an Iranian president since the 1979 revolution, underlining a thaw in relations since Egyptians elected an Islamist head of state.
President Mohamed Mursi, the Muslim Brotherhood politician elected in June, kissed Ahmadinejad as he disembarked from his plane at Cairo airport. The leaders walked down a red carpet, Ahmadinejad smiling as he shook hands with waiting dignitaries.
Visiting Cairo to attend an Islamic summit that begins on Wednesday, the president of the Shi'ite Islamist republic is due to meet later on Tuesday with the grand sheikh of al-Azhar, one of the oldest seats of learning in the Sunni world.
Such a visit would have been unthinkable during the rule of Hosni Mubarak, the military-backed autocrat who preserved Egypt's peace treaty with Israel during his 30 years in power and deepened ties between Cairo and the West.
"The political geography of the region will change if Iran and Egypt take a unified position on the Palestinian question," Ahmadinejad said in an interview with Al Mayadeen, a Beirut-based TV station, on the eve of his visit.
He said he wanted to visit the Gaza Strip, the Palestinian territory which neighbours Egypt to the east and is run by the Islamist movement Hamas. "If they allow it, I would go to Gaza to visit the people," Ahmadinejad said.
Analysts doubt that the historic changes that brought Mursi to power in Egypt will result in a full restoration of diplomatic ties between states whose relations were broken off after the Iranian revolution and the conclusion of Egypt's peace treaty with Israel in 1979.
At the airport the two leaders discussed ways of boosting relations between their countries and resolving the Syrian crisis "without resorting to military intervention", Egyptian state media reported.
Egypt is concerned by Iran's support for Syrian President Bashar al-Assad, who is trying to crush an uprising inspired by the revolt that swept Mubarak from power two years ago. Egypt's overwhelmingly Sunni Muslim population is broadly supportive of the uprising against Assad's Alawite-led administration.
The Mursi administration also wants to safeguard relations with Gulf Arab states that are supporting Cairo's battered state finances and are deeply suspicious of Iran.
Egyptian Foreign Minister Mohamed Kamel Amr reassured Gulf Arab allies that Egypt would not jeopardise their security.
"The security of the Gulf states is the security of Egypt," he told the official MENA news agency, in response to questions about Cairo's opening to Iran and its impact on other states in the region.
Mursi wants to preserve ties with the United States, the source of $1.3 billion in aid each year to the influential Egyptian military.
His government has established close ties with Hamas, a movement backed by Iran and shunned by the West because of its hostility to Israel, but its priority is addressing Egypt's deep economic problems.
"The restoration of full relations with Iran in this period is difficult, despite the warmth in ties ... because of many problems including the Syrian crisis and Cairo's links with the Gulf states, Israel and the United States," said one former Egyptian diplomat.
Speaking to Reuters on the sidelines of preparatory meetings for the two-day Islamic summit, Iranian Foreign Minister Ali Akbar Salehi said he was optimistic that ties could grow closer.
"We are gradually improving. We have to be a little bit patient. I'm very hopeful about the expansion of the bilateral relationship," he said. Asked where he saw room for closer ties, he said: "Trade and economics."
Ahmadinejad's visit to Egypt follows Mursi's visit to Iran in August for a summit of the Non-Aligned Movement.
Sheikh Ahmed al-Tayeb, head of the 1,000-year-old al-Azhar mosque and university, will meet Ahmadinejad at his offices in mediaeval Islamic Cairo, al-Azhar's media office said.
Salehi, the Iranian foreign Minister, stressed the importance of Muslim unity when he met Sheikh al-Tayeb at al-Azhar last month.
Egypt and Iran have taken opposite courses since the late 1970s. Egypt, under Mubarak's predecessor Anwar Sadat, concluded a peace treaty with Israel in 1979 and became a close ally of the United States and Europe. Iran from 1979 turned into a centre of opposition to Western influence in the Middle East.
Symbolically, Iran named a street in Tehran after the Islamist who led the 1981 assassination of Sadat.
Egypt gave asylum and a state funeral to Iran's exiled Shah Reza Pahlavi, who was overthrown by the 1979 Iranian revolution. He is buried in a medieval Cairo mosque alongside his ex-brother-in-law, Egypt's last king, Farouk.
Additional reporting by Ayman Samir and Alexander Diadosz; Editing by Andrew Roche and Paul Taylor