The Iranian Supreme Court has vacated the murder convictions of a group of serial killers because their victims were engaging in un-Islamic activities, the British Broadcasting Corp. reports.

The men were convicted for a series of grisly killings in the southeastern city of Kerman in 2002. The vigilantes were said to believe that Islam condoned the killing of anyone engaged in illicit activities if they issued two warnings to the victims, the BBC reports.

At least 18 people were killed on the murder spree, but the men were only tried for five of the deaths. Some of the victims were stoned, others were suffocated and at least one man was buried alive, according to the vigilantes' confessions.

These men told the court that their understanding of the teachings of one Islamic cleric allowed them to kill immoral people if they had ignored two warnings to stop their bad behavior, according to the BBC.

The Supreme Court has overturned the verdict of a lower court that found all the men guilty of murder five times, according to lawyers for the victims' families. The vigilantes may still be liable for monetary damages.