Egypt's President Mohamed Morsi speaks during the Laylat al-Qadr in Cairo. Morsi will visit Tehran at the end of the month. Reuters

The office of Egyptian President announced on Monday that Mohammed Morsi would be attending the Non-Aligned Movement summit in Tehran at the end of August.

This marks the first time an Egyptian official will visit Iran since Cairo and Tehran severed ties after the Iranian Revolution over 30 years ago.

The Non-Aligned Movement is a bloc of countries that don't consider themselves officially allied with any other major power bloc. Morsi is currently the Secretary-General of the Movement. At the meeting, he will transfer his leadership to Iran.

"This really signals the first response to a popular demand and a way to increase the margin of maneuver for Egyptian foreign policy in the region," said political scientist Mustafa Kamel el-Sayyed to the Wall Street Journal. "Morsi's visits ... show that Egypt's foreign policy is active again in the region."

While the visit is being widely hailed as a sure-fire step to rebuilding the Cairo-Tehran relationship, it's not without its complications. In June Morsi threatened to sue the Iranian Fars news agency for supposedly "fabricating an interview" in which he said he supported re-establishing ties with Iran (incidentally, Morsi also recently denied sending notes back and forth with Israeli President Shimon Peres asking to re-establish ties with Israel).

And Iran's sour relationship with the West and the US over its nuclear program is likely to make awkward the fact that Egypt's military is heavily sponsored by the US, says Reuters.

Relations between Egypt and Iran were badly damaged when the Shah of Iran, Mohammad Reza Pahlavi, was given temporary refuge in Egypt under the auspices of Anwar Sadat in 1979. Tehran was already outraged by the peace accords that Cairo signed with Israel at the 1978 Camp David peace treaty. Since that time, Iran looked unfavorably at President Hosni Mubarak's strong alliance with both Israel and the United States.