Maghreb than they did with religious leaders in the nearby countryside. Sufism, maraboutism, and other more "heterodox" Islamic currents were more prominent in rural areas. Indigenous Berber religions and religious practices also continued to linger in these areas. Some Sufi brotherhoods, especially those led by sharifian families, posed a potential political challenge to Marinid rule and were involved in occasional rebellions, but in general the Marinids attempted to incorporate them into their sphere of influence. They also used their patronage of Maliki institutions as a counterbalance to Sufism. Sufism was also practiced in the cities, often in a more scholarly form and with the involvement of the sultan, state officials, and various scholars. Language As the ruling family and its supporting tribes were Zenata Berbers, Berber (Tamazight) was generally the language spoken at the Marinid court in Fez. The Marinids also continued the Almohad practice of appointing religious officials who could preach in Tamazight. Tamazight languages and dialects also continued to be widely spoken in rural areas. However, Arabic was the language of law, government, and most literature, and assimilation of the region's population to Arabic language and culture also advanced significantly during this period. Culture Intellectual life and education The Marinids were eager patrons of Islamic scholarship and intellectual culture. It was in this period that the Qarawiyyin, the main center of learning in Fes, reached its apogee in terms of prestige, patronage, and intellectual scope. Additionally, the Marinids were prolific builders of madrasas, a type of institution which originated in northeastern Iran by the early 11th century and was progressively adopted further west. These establishments served to train Islamic scholars, particularly in Islamic law and jurisprudence (fiqh). The madrasa in the Sunni world was generally antithetical to more heterodox religious doctrines, including the doctrine espoused by the preceding Almohads. As such, it only came to flourish in Morocco under the Marinids that followed them. To the Marinids, madrasas played a part in bolstering the political legitimacy of their dynasty. They used this patronage to encourage the loyalty of Fes's influential but fiercely independent religious elites and also to portray themselves to the general population as protectors and promoters of orthodox Sunni Islam. The madrasas also served to train the scholars and elites who operated their state's bureaucracy. The majority of documented madrasa constructions took place in the first half of the 14th century, especially under the reign of