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.Criminal Law - Cases and Materials, 7th ed. 2012, Wolters Kluwer Law & Business; John Kaplan, Robert Weisberg, Guyora Binder, , This would make the perpetrator legally insane as they would be incapable of distinguishing right from wrong.
See also Command hallucination
Ethics of Søren Kierkegaard, view that God may communicate commands directly to individuals and these should be obeyed disregarding all moral obligations
References