Iran's Supreme Leader Ayatollah Ali Khamenei warned on Wednesday that any attempts to disrupt the presidential election on May 19 would be dealt with harshly.
- Iran threatens Saudi Arabia: Only Mecca and Medina will remain if war breaks out
- Trump, the Middle East peacemaker? Give craziness a chance
- Iran's Revolutionary Guards quietly backing hardliner as elections loom
The vote has shaped up to be primarily a contest between incumbent President Hassan Rohani, a pragmatist who has campaigned on a platform of opening up the country to the West and easing social restrictions, and hardline rival Ebrahim Raisi, who served in top positions in the judiciary for years.
The election will be held as Rohani, elected in a landslide in 2013, is coming to the end of his four-year term.
Raisi has the backing of Khamenei, according to analysts.
"If people participate with order, behave morally, observe legal and Islamic parameters then this will be a source of honor for the Islamic Republic," Khamenei said, according to the transcript of a speech published on the Supreme Leader's official website.
"But if they break the law, operate in an immoral way, or speak in a way that will encourage enemies, then the elections can be seen as a loss."
Dozens of people were killed and hundreds arrested when widespread protests broke out after a disputed presidential election in 2009, which kept Mahmoud Ahmadinejad in office for a second term, according to human rights groups.
"The security of the country must be completely preserved during the election," Khamenei said in the speech, which was delivered to an audience that included top commanders from the Revolutionary Guards, the most powerful military and economic force in the country.
"Anyone who deviates from this path should certainly know that they will be given a slap."
Rohani is standing for a second term against five other candidates, including his own vice president Ishaq Jahangiri, a moderate, and Tehran mayor Mohammad Baqer Qalibaf, a hardliner.
If nobody wins more than 50 percent of the votes cast in the first round on May 19, there will be a run-off a week later.
Raisi has harshly criticized Rohani's economic performance during live presidential debates in the past two weeks.
Khamenei is also unhappy with Rohani's economic performance and said the government should have done more to tackle unemployment.
Iran has an unemployment rate of 12.7 percent for a population of about 80 million, according to figures released by the Statistical Center of Iran last autumn.
Rohani, for his part, has indirectly criticized Raisi's time at the judiciary.
"The people of Iran will announce in (the May election) that they don't accept those who only knew executions and prison for 38 years," Rohani said Monday, according to the Iranian Students' News Agency.