Society or religion

Is “Society or Religion”  the foundation of  morality?  This is a topic that has been  bothering me ever since and no matter how I think about it I never reach a consensus. Some will say society while some holds that religion is the foundation, others are even of the view that religion and society cannot be separated and that they both serve as the foundation.  That is why I have made it an open discussion, so what is your view?