Mr. Rowhani made it clear that he rejected such policies, saying that an Islamic society is not monolithic. “We must accept various trends and tastes,” he said. “It is not possible for one taste to rule in a free and large society.”

He warned hard-liners that Iran needed tolerance in order to achieve progress. “Danger is when — God forbid — one group considers itself equal to Islam, equal to the revolution, equal to the supreme leader,” he said of the hard-liners, often called the traditionalists. “They introduce the others as being against all this. All problems originate from this point.”

Mr. Rowhani’s attacks on the traditionalists have astonished Iranians. Many in the country assumed the traditionalists had quietly taken hold of power during the past decade, ousting reformists and other groups calling for change. But it remains to be seen whether Mr. Rowhani can bring about real changes in people’s lives.

It will be hard, for example, for Mr. Rowhani to turn around Iran’s sanctions-ridden economy without an agreement of some sort with the United States on Iran’s nuclear program, and the supreme leader, Ayatollah Ali Khamenei, has the last word on that matter. But talking of freedoms will at least raise hopes for Iran’s sprawling urban middle classes.

At the same time it is unclear how much space Mr. Rowhani will actually be given by Iran’s other centers of power: the judiciary, the armed forces and the alliance of hard-line clerics and commanders. For now, Ayatollah Khamenei has called upon all forces to fully support Mr. Rowhani.

It is not clear how much cooperation Mr. Rowhani can expect. On Sunday, the state newspaper Kayhan, a mouthpiece of the hard-liners, said Mr. Rowhani was a hard-liner himself and urged him not to pick any reformist politicians for his cabinet.

Mr. Rowhani said he was consulting with many candidates to form a cabinet based on skills rather than on ideology, and he criticized those trying to influence him through the news media, saying, “Such measures will not bring anything but the people’s tiredness.”