Those that fail, do so, because the morality is subjective and relative to the morality of a subset of the population under the rule of law. That, and those remove rights held by one class of people merely to uphold the personal belief of another class of people. Those that do succeed often do so, because they transcend classes and benefit the entire society. Laws against murder are beneficial to both religious classes and secular. But no law can control or prevent a person from having murderous thoughts. One group may find such thoughts morally wrong, but their morality is not the law, nor can it be enforced in any way if it were. Porn might be a better example, since there are those that do not have moral issues with it, while there are probably far fewer out of all classes that would consider harboring persistent murderous thoughts as useful or even healthy, though not illegal.