In precolonial times, these were the primary sources for education in the area, and taught basic literacy to a large proportion of children even in quite remote mountainous areas - leading to a 40% literacy rate in Algeria in 1830, for instance, which was actually higher than after the French left. Their curriculum began with memorization of the Arabic alphabet and the later, shorter suras of the Qur'an; if a student was sufficiently interested or apt, it progressed to law (fiqh), theology, Arabic grammar (usually taught with al-Ajurrumi's famous summary), mathematics (mainly as it pertained to inheritance law), and sometimes astronomy. These are still operational throughout the Maghreb, and continue to be a major educational resource in the Sahel of West Africa, from Mauritania to Nigeria.
Among the Hassaniya Arabic-speaking populations of Mauritania, Western Sahara, Morocco, Mali and Algeria (often referred to as Moors/Maure and Sahrawis), the term is also used to signify a certain type of tribe. Sahrawi-Moorish society was traditionally (and still is, to some extent) stratified into several tribal castes, with the Hassane warrior tribes ruling and extracting tribute - horma - from the subservient znaga tribes. A middle caste was formed by the Zawiya, or scholarly tribes, who provided religious teaching and services. This did not necessarily mean that they maintained a monastery or school as described above, since all these tribes were more or less nomadic. Hoewever, important shaykhs would sometimes create schools, or, after their deaths, their graves would turn into holy places of significance to the tribe.
Often, the Zawiya tended to be descended from Sanhadja Berbers, while the Hassane claimed lineage from the Beni Hassan Arabs. Even if intermarriage and tribal alliances made the distinction difficult to maintain from a scientific perspective, it was culturally important; however, from about the 19th century, most or all Sahrawi-Moorish tribes had adopted the Hassaniyya Arabic dialect and come to regard themselves as Arabs. Sometimes, the Zawiya and Hassane roles changed with this: military and economic strength would often lead to a gradual redefinition of the tribe's role, and, simultaneously, to its self-perception of religious and ethnic background. Especially in the northern Hassane areas, i.e. today's Western Sahara, the Zawiya tribes were more or less synonymous with the Chorfa, tribes who claimed descent from the Prophet Muhammad. In the areas corresponding broadly to today's Mauritania, this was not necessarily so; there, the name "Marabout" is also used synonymously with "Zawiya" in its tribal meaning.