How religion went bad

E.O. Wilson in Consilience: The Unity of Knowledge:

The rising agricultural societies, egalitarian at first, became hierarchical.  As chiefdoms and then states thrived on agricultural surpluses, hereditary rulers and priestly castes took power.  The old ethical codes were transformed into coercive regulations, always to the advantage of the ruling classes.  About this time the idea of law-giving gods originated. Their commands lent the ethical codes overpowering authority, once again – no surprise – to the favor of the rulers.