The deific decree delusion is a defense in a criminal case in which a person committed a crime in the belief that their God ordered them to do it. This would make the perpetrator legally insane as they would be incapable of distinguishing right from wrong.
See also Command hallucination Duress in American law § Insane duress Ethics of Søren Kierkegaard, view that God may communicate commands directly to individuals and these should be obeyed disregarding all moral obligations
References