IRNA, the state-controlled news agency, dismissed Mr. Trump’s message Monday as “bullying words and the rhetoric he uses especially in his early-morning tweets.”

Mr. Trump’s emphatic tweet about Iran, with its reminders of the enormous military power the United States projects in the Persian Gulf, had echoes of his treatment of North Korea last summer. He would often denounce the regime as corrupt. In the president’s mind, these threats destabilized the North and forced it into negotiations over its nuclear weapons and missile programs.

Iran is both an easier case and a harder one than North Korea. There are no signs that it possesses nuclear weapons now or could in the near future. It has not made any move to pull out of the 2015 deal, even after the United States did. Its leaders appear convinced that Mr. Trump is trying to goad them into making a mistake.

Mr. Trump’s warning to Iran came hours after a speech by Secretary of State Mike Pompeo that was harshly critical of Iran’s leadership. Mr. Pompeo accused Iran’s leadership of widespread corruption at the expense of its citizens’ welfare.

“Governments around the world worry that confronting the Islamic Republic harms the cause of moderates, but these so-called moderates within the regime are still violent Islamic revolutionaries with an anti-America, anti-West agenda,” Mr. Pompeo said in the speech at the Ronald Reagan Presidential Library in Simi Valley, Calif. “You only have to take their own words for it.”

Mr. Pompeo also sought to reach out to the people of Iran in his speech and messages posted online. “The United States hears you. The United States supports you. The United States is with you,” he tweeted Sunday in Persian and English.