page_title: History of medieval Tunisia
section_title: Life and career
hierarchical_section_title: History of medieval Tunisia / Ibn Khaldun / Life and career
context_page_description: The medieval era of Tunisia starts with what will eventually return Ifriqiya to local Berber rule. The Shia Islamic Fatimid Caliphate departed to their newly conquered territories in Egypt leaving the Zirid dynasty to govern in their stead. The Zirids would eventually break all ties to the Fatimids and formally embrace Sunni Islamic doctrines.
  During this time there arose in Maghrib two strong local successive movements dedicated to Muslim purity in its practice. The Almoravids emerged in the far western area in al-Maghrib al-Aksa establishing an empire to as north as modern Spain and south to Mauretania; Almoravid rule never included Ifriqiya. Later, the Berber religious leader Ibn Tumart founded the Almohad movement, supplanted the Almoravids, and would eventually bring under the movement's control al-Maghrib and al-Andalus. Almohad rule would be succeeded by the Tunis-based Hafsids. The Hafsids were a local Berber dynasty and would retain control with varying success until the arrival of the Ottomans in the western Mediterranean.
context_section_description: A major social philosopher, Ibn Khaldun (1332–1406) is recognized as a pioneer in sociology, historiography, and related disciplines. Although having Yemeni ancestry, his family enjoyed centuries-long residency in al-Andalus before leaving in the 13th century for Ifriqiyah. As a native of Tunis, he spent much of his life under the Hafsids, whose regime he served on occasion.
  Ibn Khaldun entered into a political career early on, working under a succession of different rulers of small states, whose designs unfolded amid shifting rivalries and alliances. At one point he rose to vizier; however, he also spent a year in prison. His career required several relocations, e.g., Fez, Granada, eventually Cairo where he died. In order to write he retired for a while from active political life. Later, after his pilgrimage to Mecca, he served as Grand Qadi of the Maliki rite in Egypt (he was appointed and dismissed several times). While he was visiting Damascus, Tamerlane took the city; this cruel conquorer interviewed the elderly jurist and social philosopher, yet Ibn Khaldun managed to escape back to his life in Egypt.
caption: Statue of Ibn Khaldoun in Tunis
exif: {}