Egypt and Iran took a giant step towards establishing full diplomatic ties when their leaders met for the first time on the sidelines of the Arab-Islamic summit in Riyadh on Saturday.
The meeting between Egypt's President Abdel Fattah El Sisi and his Iranian counterpart Ebrahim Raisi received little publicity, with focus directed on the summit itself, where leaders from more than 50 nations discussed ways to end the Gaza war, now in its sixth week.
Relations between the two regional powerhouses have been fraught for decades.
The meeting was held amid fears that the Gaza war could escalate into a wider conflict involving groups loyal to Iran and others and because of the high death toll among civilians in Gaza.
Iran is the main backer of the Palestinian Hamas group whose deadly foray into southern Israel on October 7 drew a harsh response from Israel.
An aerial onslaught has since killed more than 11,000 Palestinians, according to the Gaza Health Ministry, devastated the coastal enclave and displaced more than half its 2.3 million residents.
A total siege of the territory by Israel has led to the scarcity of fuel, water and electricity. Humanitarian supplies reaching Gaza through a border crossing with Egypt have fallen way short of Gaza's needs.
Unlike Iran, Israel's sworn enemy, Egypt has had a peace treaty with the country since 1979. It also maintains a working relationship with Hamas and other Gaza-based militant groups.
Sharing a border with Gaza and Israel, Egypt has in the past mediated between Hamas and Israel to end bouts of fighting.
Until the outbreak of the current war, Egypt and Israel had closely co-operated on counterterrorism and combating human and drug trafficking through their common border in the Sinai Peninsula.
Besides being the main backer of Hamas and other groups in Gaza, Iran holds the key to broadening the war through a network of allied groups such as Hezbollah in Lebanon, the Houthis in Yemen and combat-seasoned Shiite militias in Iraq and Syria.
Iran and Egypt have been in frequent contact over the Gaza war since it began five weeks ago, with their foreign ministers holding a series of telephone calls.
A presidential statement issued in Cairo following the meeting between Mr El Sisi and his Iranian counterpart revealed: “The two leaders touched in their discussion on the importance of not allowing the conflict to become broader and the protection of the region's security and stability."
Egyptian officials who are regularly briefed on the Iran-Egypt diplomatic process said Cairo and Tehran intended to soon appoint ambassadors to each other's capital.
They said the two leaders had reviewed the prospects of economic and security co-operation.
Mr El Sisi also invited Mr Raisi to visit Egypt but no date has been set, according to the officials.
Relations between Egypt and Iran began to sour in the aftermath of the 1979 Islamic revolution when the late Egyptian leader Anwar Sadat welcomed the deposed Shah Mohammad Reza Pahlavi to Egypt, allowing his burial in Cairo a year later after he died of cancer.
There was a relative thaw after a popular uprising forced long-time autocratic leader Hosni Mubarak to step down after 29 years in power. Mohammed Morsi was elected Egypt's president in 2012 but was removed a year later. Relations with Tehran cooled after Mr El Sisi took office in 2014.
More recently, relations have been tense over what Cairo sees as Iran’s meddling in the internal affairs of Arab nations such as Iraq, Syria, Lebanon and Yemen.
In a thinly veiled reference to Iran, Mr El Sisi has repeatedly declared Egypt's willingness to come to the aid of its Gulf Arab allies and benefactors if they faced an external threat.
Egyptian officials believe normalised relations with Iran would secure Tehran's goodwill over Cairo's efforts to forge closer economic and commercial ties with countries such as Iraq, Syria and Lebanon, where Iran wields significant influence.