Ayatollah Khamenei, right, talks to Sultan of Oman Qaboos bin Said al Said as Iranian President Hassan Rowhani looks on, in Tehran on Aug. 26. (Ayatollah Ali Khamenei’s official Web site/European Pressphoto Agency)

Iran’s supreme leader, Ayatollah Ali Khamenei, said Tuesday that his country should embrace diplomacy over militarism, saying it was time for “heroic leniency,” and signaled his embrace of international outreach efforts by new president Hassan Rouhani.

Although Khamenei said the Islamic republic must never abandon its revolutionary ideals and objectives, he said it was time to address Iran’s diplomatic disputes with major world powers.

In an interview aired Tuesday evening by the Spanish-language broadcaster Telemundo, President Obama said that an opportunity for diplomacy has arisen.

“I hope the Iranians take advantage of it,” he said. “There are indications that Rouhani, the new president, is somebody who is looking to open dialogue with the West and with the United States in a way that we haven’t seen in the past. And so we should test it.”

For talks to succeed, Obama said, Iran needs to “show the international community that it’s not trying to weaponize nuclear power.”

Obama also reiterated that he had exchanged letters with Rouhani — something the Iranian Foreign Ministry had acknowledged earlier in the day.

“I agree with what I called ‘heroic leniency’ years ago,” Khamenei said in a speech Tuesday, “because such an approach is very good and necessary in certain situations, as long as we stick to our main principles.”

Khamenei’s words were the clearest indication to date that Rouhani’s government has the supreme leader’s support, which will be essential in reaching any deals with the United States and other world powers over Iran’s nuclear activities.

“Rouhani and his foreign minister, Mohammad Javad Zarif, may not have approval from the Islamic republic establishment as a whole, but at this point it looks increasingly clear that they have the support of Ayatollah Khamenei and other key establishment figures,” said Reza Marashi, research director at the National Iranian American Council in Washington.

In his speech, Khamenei also rejected the assertion made by some world powers that Iran is trying to develop nuclear weapons and accused such countries of a three-pronged policy of “making wars, poverty and corruption.”

“We do not believe in nuclear weapons because of our beliefs, not for the sake of the U.S. or other countries,” Khamenei said. “And when we say that no country should possess nuclear weapons, we ourselves are definitely not trying to possess them.”

Khamenei delivered his speech at a meeting of members of Iran’s Islamic Revolutionary Guard Corps a day after Rouhani addressed the same group.

Khamenei told the military commanders that “it is not necessary for the IRGC to be active in the political field, but defending the revolution requires that they understand political realities.”

The supreme leader’s comments came just ahead of a scheduled trip to New York by Rouhani and his foreign policy team for the annual U.N. General Assembly.

Rouhani and Obama are to address the gathering next Tuesday.