File photo: In this photo taken by an individual not employed by the Associated Press and obtained by the AP outside Iran, Iranians protests the death of 22-year-old Mahsa Amini after she was detained by the morality police, in Tehran, Oct. 1, 2022. AP
The Supreme Court's decision came after a lower court sentenced an 18-year-old to death in a separate case related to the protests sparked by the death in custody of 22-year-old Mahsa Amini on September 16.
Following a review, the appeals of Mohammad Mahdi Karami and Seyed Mohammad Hosseini "were not found to be valid, so their sentences were upheld and approved," the Supreme Court said in a statement.
The death sentences against co-accused Hamid Ghare-Hasanlou, Hossein Mohammadi and Reza Aria were overturned "due to the existence of defects in the proceedings," the court said, adding that they would now be retried.
Amnesty International said Ghare-Hasanlou, a doctor, and his wife had been "caught up in the chaos" which resulted in the paramilitary's death.
Prosecutors said that Ruhollah Ajamian, a member of the Basij paramilitary force, was stripped naked and killed in Karaj, west of Tehran, on November 3 during a commemoration for slain protester, Hadis Najafi.
The court also ordered retrials for 11 other defendants handed lengthy prison terms in the case.
The supreme court decision came as a lower court sentenced Mehdi Mohammadifard to death after convicting him of the capital offences of "corruption of earth" and "enmity against God", the judiciary's Mizan Online news website said.
Mohammadifard was found guilty of "committing arson, destroying public property, colluding and conspiring to commit a crime against the country's security and inciting people to cause insecurity," Mizan said.
Human rights groups outside Iran have said that Mohammadifard is 18 years old and was accused of torching a traffic police kiosk in the western town of Nowshahr.
He too can appeal to the supreme court.
Iran has been rocked by protests and unrest since the the death Amini, an Iranian Kurdish woman who was arrested for allegedly violating the country's strict dress code for women.
The authorities say hundreds of people, including members of the security forces, have been killed in what they describe as "riots". Thousands have been arrested.
Iran's courts have handed down 13 death sentences in connection with the protests, five of them for Ajamian's killing.
Two convicts were hanged in December. Mohsen Shekari and Majidreza Rahnavard, both 23, had been convicted of separate attacks on the security forces.
The Supreme Court has rejected the appeals of two other death row prisoners, Mohammad Boroghani and Mohammd Ghobadlou, also convicted of attacks on the security forces. It has ordered six retrials.