TEHRAN — Iran’s triumphal stewardship of the Nonaligned Movement summit meeting here veered off script on Thursday when the two most prominently featured guest speakers — President Mohamed Morsi of Egypt and the United Nations secretary general, Ban Ki-moon — denounced the repression of the armed uprising in Syria, a close Iranian ally.

Syria’s foreign minister walked out in protest over Mr. Morsi’s remarks at the meeting, the largest international conference in Iran since the 1979 Islamic Revolution. Iranian leaders have portrayed the meeting, attended by delegations from 120 countries, as a validation of Iran’s importance in the world and a rejection of Western attempts to ostracize it.

Mr. Ban added further embarrassment to the Iranian hosts by publicly upbraiding them in his speech for threatening to annihilate Israel and for describing the Holocaust as a politically motivated myth. “I strongly reject threats by any member state to destroy another or outrageous attempts to deny historical facts, such as the Holocaust,” Mr. Ban said.

In what appeared to signal Iran’s effort to avoid public friction over the Syrian conflict that would detract from the tone of the Nonaligned conference, Ayatollah Ali Khamenei, Iran’s supreme leader, opened the day with a welcoming speech that conspicuously avoided any mention of Syria. But the subsequent speeches by Mr. Morsi and Mr. Ban refocused attention on it.