The Almoravids were a dynasty that arose among the desert nomads of the Saharan Ṣanhāja, a confederation of some seventy tribes, the three most important of which were the Gudāla, the Lamtūna, and the Massūfa, in present-day Mauritania. Although Islam had most probably come to the region through Muslim traders in the early fourth/tenth century, these tribes only adopted certain ritualistic elements of the faith. Yaḥyā b. Ibrāhīm (d. c. 444/1053), the chief of both the Gudāla tribe and the Ṣanhāja confederation, made a pilgrimage to Mecca