In a Friday speech for the Eid al-Adha holiday, Ayatollah Khamenei said that entering talks with Washington over Iran’s nuclear program, as President Trump has urged Tehran to do, would only improve Mr. Trump’s chances of being re-elected in November. That, the ayatollah said, was Mr. Trump’s reason for suggesting such talks in the first place.

“He is going to benefit from negotiations,” Ayatollah Khamenei said. “This old man who is in charge in America apparently used negotiations with North Korea as propaganda,” he added — a reference to Mr. Trump’s high-profile nuclear diplomacy on another front, which to date has been mostly fruitless.

Ayatollah Khamenei also said that Iran would maintain its close alliances with militia groups in the region that it uses as proxies, defying another demand from the Trump administration.