Iran's President Hassan Rouhani said Sunday that government bodies must provide "space for criticism" as he sought to head off days of unrest, but warned protesters that violence was unacceptable.

"Criticism is different to violence and destroying public property," he said in a cabinet meeting, according to the state broadcaster.

"Government bodies should provide space for legal criticism and protest," Rouhani said in his first public comments since the protests began on Thursday.

He also said US President Donald Trump had "no right" to sympathise with Iranian protesters who he has previously called terrorists.

"This man who today in America wants to sympathise with our people has forgotten that a few months ago he called the nation of Iran terrorist," Rouhani told the cabinet meeting.

"This person whose whole being is against the nation of Iran has no right to feel pity for the people of Iran."

Protests against economic conditions began in second city Mashhad on Thursday before quickly spreading across the country and turning against the Islamic regime as a whole.

"The point should be made clear to everyone that we are a free nation and according to the constitution... the people are absolutely free in expressing their criticisms and even protests," he said.

"At the same time we should not allow for an atmosphere to be created in which the supporters of the revolution and the people are worried about their lives and security."

Several hundred people gathered in Tehran and the western city of Khorramabad on Sunday evening in the fourth day of demonstrations.

Unconfirmed videos on social media showed protests in other parts of the country, with people shouting "Death to the dictator".

Rouhani, who was re-elected in May on promises of boosting the economy and improving civil liberties, said people were demanding more transparency.

He said state broadcaster IRIB should better reflect different opinions after criticism in recent days that the media has been stifled.

"The resolving of some issues is not easy and it will take time and the government and the nation must join hands to solve them," Rouhani said.