Every law ever made is based upon someone’s sense of morality, religiously inspired or not.
Laws are created to allow for the smooth functioning of society.
End of story.
Anything else is excess and should be removed.