The enemy of me is the enemy of God
Iran has a section of its penal code that makes quite clear why it gets to execute pretty much anyone who opposes it.
Article 186 of Islamic Penal Code states that when any group or organization attempts armed confrontation against the Islamic Republic of Iran, so long as its leadership is intact, all its members and supporters who are aware of the organization’s positions and take steps to further its objectives, are “enemies of God,” even if they are not involved in its military branch. Article 190 of Islamic Penal Code states that there are four possible punishments for “war against God or corruption on earth”: death, death by hanging; amputation of the right hand and then the left foot; or permanent internal exile. Article 191 of the Islamic Penal Code gives the judge the discretion to choose the punishment.
I trust that’s clear enough. Iran is the same thing as God, so anyone who opposes Iran by joining some armed group becomes an enemy of God, and therefore Iran gets to terminate such opposition here on planet earth by sending that opponent to…somewhere else. You can’t say fairer than that, can you.