The goal of human society, ibn Khaldun thought, was the development of culture and the sciences. For the arts and sciences to become developed and refined, specialists must train and practice for long periods of time, in order to develop the necessary habits to a high pitch. (Ibn Khaldun, a noted poet in his time, nicely described poetry as "a technical habit of the tongue".) For these specialists to be able to make a living while doing so, they must live in cities, and those cities must be flourishing economically, so that there is enough demand for their specialties, and so that there is a surplus to pay for such luxuries as poetry, craftwork and astronomy. This is only possible if there is government and the state --- ibn Khaldun, rather more realistically than Weber, defined the state as that institution whose function is to suppress all such injustices as it does not itself commit. For the state to be able to do this, it must be militarily effective. Military effectiveness, he thought, depends not just on individual courage, but also the solidarity ('asabiyya) of the soldiers with one another and with their leaders. People raised in conditions of luxury do not (reliably, or for the most part) have such feelings of solidarity, nor do ordinary townsmen and peasants, since their safety and survival is guaranteed for them by the state. It is only barbarians living in mountains and deserts, whose survival is crucially dependent on mutual support against the elements and against other tribes, who will develop the feelings of solidarity on which military power rests.
Cosma Shalizi on Ibn Khaldun
(for readers of Portuguese, there's also Identificação, Ásabiyah e Cultura: Ibn Khaldun e Freud by Alfredo Henrique Caldeira Lustosa Cabral)