People gather to protest over high cost of living in Tehran, Iran on December 30, 2017.

Protesters in Iran who have staged three days of demonstrations over economic hardship and alleged corruption should pay a high price if they break the law, the government said on Sunday.

The wave of anti-government demonstrations in several cities are the biggest challenge to Iran's leaders since unrest in 2009 that followed the disputed re-election of then-President Mahmoud Ahmadinejad went on for months.

Protesters have attacked banks and government buildings and burned a police motorcycle. Two protesters were shot dead in the western town of Dorud on Saturday night. The deputy governor of Lorestan province blamed foreign agents for the deaths.

"No shots were fired by the police and security forces. We have found evidence of enemies of the revolution, Takfiri groups and foreign agents in this clash," Habibollah Khojastehpour said in an interview on state television on Sunday. Takfiri is a term for Sunni militants especially the Islamic State.

State media also quoted Interior Minister Abdolreza Rahmani Fazli as saying: "Those who damage public property, violate law and order and create unrest are responsible for their actions and should pay the price."

Ahmad Khatami, a hardline cleric who leads Friday prayers in the capital Tehran, said the protests were similar to those in 2009 over alleged electoral fraud.