Somalia Social Experiment
The example of Somalia shows why religion almost always becomes the pre-eminent authority of a society. In a situation of complete anarchy, thieves and bandits will take whatever they want. Murders will followed by revenge.
Then protective groups will form, as people pitch their allegiance geographically to get some relief from the bandits and murderers. But in the absence of a strong philosophy these groups will end up fighting each other, since they will usually be lead by bandits and murderers who are only protecting their people to get more of what they want.
Finally, a group filled with religious fervor will inspire a righteous energy in its followers, who will believe that their group should lead because it is blessed by God. This belief is infectious and it offers the promise of social stability, hence the religious group will continue to gain adherents, and in the end even most of the bandits and murderers will join in.
Religion IS a means of controlling the masses, but contrary to what many think it doesn't come down from the top, from the wealthy who wish to control the masses for their own ends. Religion is the masses means of controlling the masses.
Of course, it can be later hijacked by the wealthy who wish to control the masses for their own ends, but that's another story.