Iran was acutely embarrassed by hard-hitting opening speeches from its two most prized guests at the summit of the Non-Aligned Movement (Nam) yesterday.
Iran's supreme leader, Ayatollah Ali Khamenei, opened the stormy two-day summit with a speech blasting the US as a meddler and Israel as a regime of "Zionist wolves".
He also said Iran would never seek nuclear weapons, which he called a "major and unforgivable sin".
But Ayatollah Khamenei insisted Iran will keep pursuing peaceful nuclear energy.
"Our motto is nuclear energy for all and nuclear weapons for none," he told about three dozen heads of state from the 120-member movement of mainly developing nations.
He also criticised the UN Security Council as an "illogical", unjust and defunct relic of the past used by the US "to impose its bullying manner on the world". The council has an "utterly undemocratic structure" and is an "overt dictatorship".
The Nam has long championed a reform of the UN to take power away from the Security Council and bolster that of the 193-member UN General Assembly, where its members are better represented.
As Mr Ban looked irritated in the audience, Ayatollah Khamenei continued: "They [the US] talk of human rights when what they mean is western interests. They talk of democracy when what they have is military intervention in other countries."
But then it was his turn, and that of the Iranian president Mahmoud Ahmadinejad, to watch stony-faced as Mr Morsi took the podium.
He likened the struggle of ordinary Syrians to that of Palestinians living under decades of Israeli occupation.
"The Palestinian and Syrian people are actively seeking freedom, dignity and human justice," Mr Morsi said.
The Syrian delegation, led by the prime minister Wael Nader Al Halqi, promptly walked out of the hall. They missed Mr Morsi adding that "Egypt is ready to work with all to stop the bloodshed".
He described the conflict in Syria as a revolution similar to the uprisings that ousted long-ruling autocrats in Tunisia, Egypt and Libya.
Iran considers the Syrian conflict is not part of the Arab Spring, but is caused largely by foreign-backed "terrorists" acting on behalf of the US and its allies in region.
One Iranian state TV television channel mistranslated Mr Morsi's remarks into Persian, giving the impression that he was speaking in support of Mr Al Assad.
Mr Morsi's visit to Tehran was the first by an Egyptian leader since Iran's 1979 Islamic revolution, signalling his determination to reclaim Egypt's role as a key regional player. Like Mr Ban, he attended in defiance of Washington, which is trying to isolate Iran.
But the Egyptian's leader's speech in Tehran indicated he is committed to pursuing a fiercely independent path.
Equally, Mr Ban, whom the US and Israel had urged to stay away from Iran, gave his hosts little comfort yesterday.
"I strongly reject threats by any member state to destroy another or outrageous attempts to deny historical facts such as the Holocaust," he said, without naming Iran.
Mr Ahmadinejad has repeatedly denied the Holocaust and this month described Israel as a "cancerous tumour".
Mr Ban also called on Iran to build confidence in its nuclear ambitions by complying fully with the Security Council over its atomic programme and cooperating with the UN's atomic watchdog, the International Atomic Energy Agency (IAEA).
The agency reported last night that Iran has doubled the number of centrifuges at an underground uranium-enrichment centre but has yet to start using the new machines to produce nuclear fuel.
The IAEA also said Iran had "sanitised" a separate military base at Parchin to such an extent that the agency's ability to investigate past suspected nuclear weapons research there would be hampered if access were granted.
The White House said it was closely studying the report. "It is not surprising that Iran is continuing to violate its obligations," White House spokesman Jay Carney said.