Legalism and religion