Muhammad al-Mustafa al-Qalqami was born in on 10 February 1830 in the
Hawdh region, the twelfth of 48 brothers. His father Muhammad Fadil wuld Mamin was the founder of the Fadiliyya order, and a member of a clan known as the
Ahl Taleb al-Mukhtar or Ahl Jih al-Mukhtar. His mother was Manna bint Ma
ʾlum of the Ijayba clan His nickname
Māʾ al-ʿAynayn means "water of two eyes" He studied under his father who taught him in the exoteric and esoteric. He was singled out among his brothers to study in
Fes. He left his father at the age of 16 to travel and study under a number of scholars. In 1858, he left to perform the
Hajj. On his way to Mecca, he went to Morocco to Essaouira, Marrakesh and Meknes. In Marrakesh, he met the heir to the sultanate,
Muhammad ibn Abd al-Rahman, and in Meknes, he met the sultan
Abd al-Rahman where he informed him of the affairs in Mauritania and received gifts from Abd al-Rahman. He spent three weeks in
Mecca. His meeting with Abd al-Rahman began close links with Morocco onwards and he would regularly visit Marrakesh and Fes from 1873 onwards. After returning from his pilgrimage, Ma al-'Aynayn briefly stayed at
Tindouf. During the journey through the Sahara, he spent time among multiple scholars and was hosted by several Saharan tribes like the
Tajakant,
al-Arusiyin,
Reguibat and
Ait Oussa. He returned to his homeland in 1861, where by then he had acquired a reputation for mastery of the esoteric and exoteric
religious sciences. Upon his return, his father gave him a turban and the title of
Shaykh. From 1871 to 1872, he established Dār al-Ḥamrāʾ () which was a
zawiya that served as his first headquarters. In 1898, Ma al-'Aynayn began building a
Ribat in
Smara, in the
Spanish Sahara (present-day
Western Sahara). His goal in creating the
Ribat, which was previously just a water center for travelers, was to launch attacks on European colonial forces and particularly the French. The Moroccan sultan
Abdelaziz assisted him in building the
Ribat, as he sent craftsmen, materials, financing and arms. In 1902, he moved there creating among other things an
Islamic
library. ==Anticolonial revolt==