Iranians are free to protest against the government but must not jeopardise security, President Hassan Rouhani has said after four days of demonstrations.
Speaking at a cabinet session, he acknowledged that there were problems that needed to be solved but warned that violence would not be tolerated.
The protests have been the biggest show of dissent since huge rallies in 2009.
There have been clashes in several cities, and Iran has restricted social networks used to organise protests.
The "temporary" restrictions on the apps Telegram and Instagram were imposed to "maintain tranquillity", state news agency Irib reports.
The protests began in the north-east as an outcry against economic hardship and rising prices, but turned political in many places, with slogans chanted against Supreme Leader Ayatollah Ali Khamenei, Mr Rouhani and Iran's interventionist foreign policy in the region.
In his latest tweet on the issue, US President Donald Trump said that Iranians were "finally getting wise as to how their money and wealth is being stolen and squandered on terrorism".
In his first public comments, Mr Rouhani criticised Mr Trump.
"This gentleman in America, who is now trying to sympathise with our nation, appears to have forgotten that he called the Iranian nation terrorists several months ago," he was reported to have said.
"This man, who is an enemy of the Iranian nation from the top of his head to his very toes, has no right to sympathise with Iranians," he added.
The Iranian president said that Iranian citizens were "completely free to express their criticism of the government or stage protests... in a way that would lead to the improvement of the country's conditions".
He acknowledged grievances over the economic situation, a lack of transparency and corruption but defended his record.
Mr Rouhani added that expressing criticism was completely different from being violent or destroying public property.
Violence flared in many places on Saturday, and videos posted online suggest demonstrations have continued in a dozen or more cities on Sunday.
Small crowds have gathered in the capital Tehran chanting "death to the dictator" and police have used water cannon to disperse protesters at a major intersection - as captured in a video obtained by BBC Persian.