Mr. Rouhani’s failure to improve people’s livelihoods has been further aggravated by recent price spikes in staples like eggs, coupled with the government’s plans to sharply reduce subsidies that many Iranians are accustomed to receiving. So resentment toward the government over economic issues is not unexpected.

While the Iranian authorities appear to have been surprised by the spontaneity and speed of the demonstrations, outside analysts have little doubt that Ayatollah Khamenei and his subordinates would use force to suppress them if they felt it necessary. And there is little to suggest that the protesters have leaders or a cohesive message, like those in the 2009 uprising.

“The ongoing protests, by contrast, show no well-defined demands, no leadership or organization, and are diffuse around Iran,” Cliff Kupchan, the chairman of the Eurasia Group, a Washington-based political risk consultancy, said in an advisory emailed to clients on Sunday.

But he also cautioned: “unrest is admittedly unpredictable — coming days could take unexpected turns. Signposts of a surprise include; a leader or small group of leaders emerging, a defined manifesto, and much larger protests.”

Mr. Trump doubled down on his frequent criticism of the Iranian government on Sunday. He posted on Twitter: “The people are finally getting wise as to how their money and wealth is being stolen and squandered on terrorism. Looks like they will not take it any longer. The USA is watching very closely for human rights violations!”

In an apparent response to Mr. Trump on Sunday, Mr. Rouhani said: “This man who today in America wants to sympathize with our people has forgotten that a few months ago he called the Iranian nation terrorist,” according to PressTV. “This person who is against the Iranian nation from head to toe has no right to feel sorry for the people of Iran.”

Senator Lindsey Graham, Republican of South Carolina, said he had talked to Mr. Trump on the phone on Sunday morning to urge him to be more forceful with the Iranian government. “It’s not enough to watch,” Mr. Graham said on CBS’s “Face the Nation.” “President Trump is tweeting very sympathetically to the Iranian people. But you just can’t tweet here. You have to lay out a plan.”