With rare exceptions, whenever Allah mentions that a particular sin is punishable by being sent to Hell, it is understood that this is a threat, not a certainty. The sin has made the person eligible for the punishment of Hell, but he or she may yet be forgiven; and this is left to Allah’s discretion. I wonder if a qadhi has a similar discretion in the matter of crimes that make an individual eligible for hadd punishments? Honest question. I know throughout Islamic history, following the injunction of Rasulullah ﷺ to avoid the hadd as much as possible, judges used to search for ways to exempt offenders from the perscribed punishments; sometimes in almost farcical ways. So I am wondering to what extent a judge has the right to sentence someone to a lesser punishment than what has been prescribed in the penal code. Or is it that, because they do not have this discretion, they must instead search for loopholes?