Ibn Khaldun
Ibn Khaldun (1332–1406) was an Arab historian and thinker, born in Tunis. For two decades he moved between the courts of North Africa, at times as chief minister, at times in prison. His skill with Berber tribes made him useful to every ruler, but in 1375 he tired of changing sides and withdrew to western Algeria, where a tribe sheltered him for three years.
There he wrote the Muqaddimah, introduction to his universal history Kitab al-Ibar. It describes how group solidarity (asabiyya) wins a dynasty its throne, and why the conquerors of a refined civilization are in turn softened and overthrown.
From 1382 he was in Cairo, where Sultan Barquq made him Maliki grand qadi in 1384, an office he held six times. At the siege of Damascus he was lowered over the wall by ropes to negotiate with Timur. He died in Cairo in 1406.