Sigmund Freud said this quote

Immorality, no less than morality, has at all times found support in religion.