The cleric had been the leader of Friday prayers in Iran's Kazeroun city. (File)

Iran on Wednesday hanged in public a man convicted of murdering the leader of main weekly prayers in the southern city of Kazeroun, state news agency IRNA said.

Hamid Reza Derakhshandeh was executed at the scene where he killed the cleric on May 29, IRNA reported, citing the chief justice of Fars province, Kazem Mousavi.

Mohammad Khorsand suffered fatal injuries when attacked with a "cold weapon" while returning from a ceremony during Ramadan, the Muslim holy month of fasting, IRNA said.

The cleric had been the leader of Friday prayers in Kazeroun, the capital of Fars province, since 2007.

After his arrest, Derakhshandeh stood trial and "confessed to the premeditated crime in the presence of judicial authorities", Mousavi was quoted as saying.

The death sentence was upheld by the supreme court and carried out after the cleric's family decided not to spare the life of the killer who refused to express regret, Fars news agency reported.

Under Iranian law, a murder victim's family can spare a convict's life by accepting blood money.

"Due to the sensitivity of the case and the public sentiments in this regard, efforts were made for the case to be investigated promptly," Mousavi said.

Imams who lead Friday prayers in Iran are appointed by supreme leader Ayatollah Ali Khamenei.