Ideology and the rise of early states