Religious origins of democracies and dictatorships