The popularity of Mr. Rouhani’s government and his political party may have been significantly weakened in the aftermath of the protests. Both supporters and opponents criticized him for what they called his mismanagement of the gasoline price increase, the suppression of the protests and an apparent indifference to the pain the uproar had caused ordinary people.

“We voted for the government of wisdom and hope,’’ said Mohamad Ali Abtahi , a prominent politician from the reform movement, in a statement posted on his Telegram channel. “This government that spilled the blood of our youth and made everyone hopeless is not the same one we elected.’’

Gholamhossein Karbaschi , a former mayor of Tehran and head of a reformist political party, said in a Twitter message that Mr. Rouhani’s conduct in the aftermath of the unrest had left him “ashamed” of having ever supported him. “There isn’t an ounce of justice or wisdom,” he said of Mr. Rouhani and his government’s handling of the crisis.

The protests struck as Iranians are dealing with an acute economic crisis caused in part by sanctions imposed by President Trump last year after he repudiated the nuclear agreement between Iran and major powers. Mr. Rouhani was a major proponent of that agreement, which limited Iran’s nuclear work in exchange for sanctions relief.

Mr. Trump called the agreement too weak and said the tough sanctions — which have deeply cut Iran’s oil exports — were part of his “maximum pressure” campaign to force Iran to renegotiate the agreement.

Mr. Rouhani has repeatedly rebuffed Mr. Trump’s offers to talk while the sanctions remain in place. Mr. Khamenei has forbid any negotiations with the Americans and told Iranians they must prepare for a protracted period of hardship.

But on Wednesday, Mr. Rouhani teased that negotiations with Mr. Trump were still possible and that if the United States lifted the sanctions the two heads of states could meet “in one hour.”