This chapter examines the responses of three important medieval Maghribī dynasties to the dilemmas posed by nomadic populations dwelling in their midst. These dynasties include the Almoravids in al-Andalus in the twelfth century, the Almohads in the Maghrib in the thirteenth century, and the Ḥafṣids, successors to the Almohads in Ifrīqiya, during the fourteenth century. The aim is to shed light on the challenges that nomadic populations posed to political legitimacy, and to suggest, paradoxically perhaps, that the presence of unruly nomads in the medieval Islamic west, and the effort to contain them, served an important role in each dynasty's attempt to gain political legitimacy in the eyes of the Muslim community.