Émile Durkheim said this quote

When mores are sufficient, laws are unnecessary; when mores are insufficient, laws are unenforceable.