Iran President Ahmadinejad begins historic Egypt visit
Mahmoud Ahmadinejad has become the first Iranian president to visit Egypt since the Islamic revolution in 1979.
Mr Ahmadinejad is in Cairo for a summit of the Organisation of Islamic Co-operation, which begins on Wednesday.
After arriving on Tuesday, he discussed with Egyptian President Mohammed Morsi ways to end the bloodshed in Syria and strengthen relations, officials said.
Mr Ahmadinejad was later warned by Egypt's top Sunni Muslim cleric not to meddle in the affairs of Gulf states.
Grand Sheikh Ahmed al-Tayeb of al-Azhar said Iran should not to seek the "extension of Shia reach" and should "respect Bahrain as a sisterly Arab state", according to a statement issued by al-Azhar's media office.
The Islamic republic has been accused by Bahrain's Sunni-led government of fomenting unrest among its majority Shia community.
The president was also told by the head of al-Azhar that Sunnis living in Iran should be guaranteed full rights.
'Pave the ground'
Diplomatic ties between Egypt and Iran broke down in 1980 after the former signed a peace treaty with Israel and gave asylum and a state funeral to Iran's exiled Shah Reza Pahlavi. In 1981, Iran named a street in Tehran after the assassin of Egyptian President Anwar Sadat.
Relations between the regional powers have improved since Egyptians elected an Islamist head of state in June.
However, they remain at odds over several issues, including Syria, which was suspended from the OIC at its last summit despite Iranian objections.
"I will try to pave the ground for developing co-operation between Iran and Egypt," Mr Ahmadinejad was quoted as saying by Iran's state news agency, Irna, before leaving Tehran.
"If Tehran and Cairo see more eye-to-eye on regional and international issues, many [issues] will change," he added.
But Egyptian Foreign Minister Mohamed Kamel Amr said any improvement in ties would not come at the expense of relations with Gulf Arab nations - Iran's regional rivals.
"The security of Gulf countries is a red line for Egypt," Mr Amr added, according to the AFP news agency.
Mr Ahmadinejad's visit follows one to Tehran by Mr Morsi for a summit of the Non-Aligned Movement in August, when the two leaders agreed to reopen embassies.
As the most populous Arab country and a historic regional heavyweight, Egypt, a predominantly Sunni power, has in the past seen itself as a political rival of Shia Iran, says the BBC's Yolande Knell in Cairo.
Some analysts have expressed concern over the apparent decision of the new Islamist leader to reconnect with Iran, our correspondent adds.
They note that Tehran hailed Egypt's uprising two years ago, which forced President Hosni Mubarak to resign, as an "Islamic awakening".
President Morsi is hosting the OIC summit following days of nationwide protests by opposition supporters in which nearly 60 people have died.
Meanwhile, Mr Ahmadinejad has criticised the Iranian judiciary's decision to arrest a close ally, former Tehran prosecutor Saeed Mortazavi.
No reason has been given for the detention of Mr Mortazavi, though reports suggest it may be linked to a long-running dispute between the president and the speaker of parliament, Ali Larijani.