Al-Qarawiyyin history 859: the under appreciated merchant’s daughter who built the world’s oldest university

Introduction to Al-Qarawiyyin history 859

In 859, a woman whose name most histories have recorded only in passing made a decision that would shape scholarship for twelve centuries. Fatima al-Fihri, daughter of a Tunisian merchant who had died and left her his fortune, chose to spend the inheritance on a mosque and centre of learning in the city of Fez. The Al-Qarawiyyin history 859 tells begins at that moment of deliberate intent: not charity, not piety alone, but the calculated construction of an institution. What she built still stands. It still teaches. By the reckoning of UNESCO and the Guinness World Records, it is the oldest continuously operating educational institution on earth.

She is said to have fasted for the entire period of construction, breaking her fast only when the building was complete. Whether or not this is literally true, it is the kind of detail that survives when an institution wants to insist on its founder’s seriousness of purpose.

The courtyard of Al-Qarawiyyin mosque in Fez, photographed in the late nineteenth century. Al-Qarawiyyin history 859.
The courtyard of Al-Qarawiyyin mosque, Fez, c.1900. The institution has occupied this site continuously since 859. Photo by JEan Du Taillis (1873-1932)

The city that gave her the means to build it

Fez in 859 was barely sixty years old and already crowded beyond the intentions of its founders. Idris II, son of the man who had established the first Arab dynasty in the western Maghreb, had expanded the original settlement on the east bank of the Oued Fes into a capital that attracted migrants from two directions simultaneously. From the east came refugees from Kairouan in present-day Tunisia, displaced by political upheaval in the Aghlabid emirate. From the north came emigrants from Cordoba in al-Andalus, unsettled by a rebellion in 818 that had fractured the city’s established communities. Both groups settled in Fez and named their respective quarters for the cities they had left: the Andalusian quarter on the west bank, the Qarawiyyin quarter on the east.

 Nineteenth-century map of Fez showing the Qarawiyyin and Andalusian quarters. Al-Qarawiyyin history 859
A nineteenth-century map of Fez showing the division between the Qarawiyyin and Andalusian quarters, the settlement pattern established by the city’s founding emigrant communities in the early ninth century.

The Fihri family arrived with the Kairouanese. Muhammad al-Fihri had been a merchant of sufficient standing to accumulate property in the new city, and when he died, his estate passed to his two daughters. Fatima used hers to found Al-Qarawiyyin. Her sister Miriam used hers to build the Mosque of the Andalusians on the opposite bank. The two foundations were made at roughly the same time, in the same act of civic and religious ambition, by two women who understood that the way to establish permanence in a new city was to build something that could not be ignored.

What Fatima al-Fihri actually built

The distinction that historians argue over is whether what Fatima founded in 859 was a university or a mosque. The honest answer is that the question applies a later European category to an institution that operated by different principles. What she built was a congregational mosque capable of serving the Qarawiyyin quarter’s growing population. Attached to it, as was standard in the Islamic world, was a space for the study of Islamic sciences: Quranic interpretation, jurisprudence, hadith, and the Arabic grammar without which all of these were inaccessible.

The educational function grew as the city grew. By the tenth century, instruction at Al-Qarawiyyin had expanded well beyond the mosque’s immediate community, drawing students from across the Maghreb and al-Andalus. By the eleventh century it was attracting scholars from sub-Saharan Africa and the eastern Islamic world. The curriculum in its mature medieval form included theology, law, grammar, rhetoric, and logic, and, depending on the period and the masters available, mathematics and astronomy. The institution conferred the ijaza, a scholarly certificate that licensed its holder to teach what he had learned and named the master who had granted it. It is this continuity of instruction and credentialing, unbroken from the ninth century to the present, that justifies the claim to be the world’s oldest functioning university.

Fatima al-Fihri died around 880, having seen the mosque completed and its educational role established. The records are silent on the details of her later years.

The Almoravids and the scholars they attracted

For two hundred years after its founding, Al-Qarawiyyin grew steadily but without the transformation that would make it the dominant institution of the western Islamic world. That transformation came with the Almoravids.

Yusuf ibn Tashfin, the Almoravid ruler who unified the Maghreb and extended his authority into al-Andalus from 1086 onwards, made Fez one of his twin capitals. The city’s population expanded dramatically. So did the resources available to its institutions. The Almoravid rulers and their Almohad successors funded expansions of Al-Qarawiyyin’s mosque and library, and the concentration of political and commercial power in Fez drew scholars who would otherwise have remained in Cordoba, Marrakech, or Tlemcen.

Abu Imran al-Fasi, born in Fez around 974 and educated at Al-Qarawiyyin before travelling east to study in Kairouan and Cairo, represents the institution’s early scholarly reach. He became one of the most influential Maliki jurists of his generation, and his students carried his interpretations of Islamic law across West Africa, a transmission that shaped legal and religious life across the Sahara for centuries. His name, al-Fasi, marks him as a man of Fez: the city and its institution of learning had become a credential in themselves.

Ibn Khaldun in the city of learning

In the winter of 1354, a twenty-two-year-old scholar from Tunis arrived in Fez carrying letters of introduction to the Marinid court. Ibn Khaldun had fled political turmoil in his home city and was looking for a patron and a place to work. He found both. The Marinid sultan Abu Inan Faris appointed him to a clerical post at court and gave him access to the library at Al-Qarawiyyin, which by the fourteenth century held one of the largest manuscript collections in the Islamic world.

A Tunisian stamp featuring the portrait of Ibn Khaldun, the fourteenth-century historian who used Al-Qarawiyyin's library in Fez. Al-Qarawiyyin history 859.
Ibn Khaldun (1332–1406), historian and sociologist, whose years using Al-Qarawiyyin’s library in Fez shaped the questions he explored in the Muqaddimah.

Ibn Khaldun spent several years in and around Fez, a period he later described as decisive for his intellectual formation. The Muqaddimah, his extraordinary introduction to a universal history that anticipated modern sociology and economics by five centuries, was not written in Fez. But the reading he did in Al-Qarawiyyin’s library, and the conversations he had with the scholars who gathered there, shaped the questions he would spend his life answering. His relationship with the Marinid court was never stable, and he left in circumstances he described with careful vagueness: court politics, imprisonment, release, and eventually departure for Granada. His relationship with Al-Qarawiyyin’s intellectual tradition was more enduring.

The library held, in Ibn Khaldun’s time, works that have since been lost. No complete catalogue survives from the fourteenth century. What is known of the collection comes largely from references in the works of the scholars who used it.

Gerbert of Aurillac and what he may have taken home

The most contested claim in Al-Qarawiyyin’s historiography concerns a young Frankish monk who arrived in the Iberian Peninsula around 967 and spent approximately three years studying in the cathedral school at Vich, in Catalonia, then at the southern edge of Christian Europe and in regular intellectual contact with al-Andalus. Gerbert of Aurillac, who became Pope Sylvester II in 999, learned mathematics and astronomy during this period that was, by the standards of contemporary Christian scholarship, extraordinary. He introduced or popularised the use of Hindu-Arabic numerals in western Europe, built astronomical instruments his contemporaries regarded with suspicion, and demonstrated a command of Aristotelian logic that would not become widespread north of the Pyrenees for another century.

Whether Gerbert visited Al-Qarawiyyin directly is not established by any contemporary source. The claim appears in later medieval accounts and cannot be verified. What is established is that the knowledge he brought back to France was consistent with what Al-Qarawiyyin and the broader Andalusian scholarly tradition were teaching in that period. The pipeline from Fez to Europe ran, in these centuries, through Cordoba and Toledo and the translation schools of the Iberian Peninsula. Al-Qarawiyyin was one of the sources. Whether Gerbert drank from it directly or at one remove is a question the surviving record cannot answer, and it would be a disservice to the history to claim otherwise.

Leo Africanus and the city at its peak

In the first decade of the sixteenth century, a young man named al-Hasan ibn Muhammad al-Wazzan grew up in Fez and received his education in the city’s scholarly institutions. Born in Granada around 1494 to a family that had emigrated after the fall of the Nasrid kingdom, he would later become known in Europe as Leo Africanus, following his capture by Sicilian pirates in 1519 and his eventual residence at the court of Pope Leo X in Rome. His Description of Africa, written in Italian and first published in 1550, contains the most detailed contemporary account of Fez and its scholarly life that survives from this period.

Portrait identified as Leo Africanus, the Fez-educated scholar who described Al-Qarawiyyin for European readers. Al-Qarawiyyin history 859.
A portrait thought to be of Al-Hasan ibn Muhammad al-Wazzan (c.1494–c.1554), known in Europe as Leo Africanus, whose Description of Africa provides the fullest surviving account of Fez and its scholarly life at the height of Al-Qarawiyyin’s medieval influence.

Leo Africanus described Al-Qarawiyyin at what was probably its medieval peak: a mosque capable of holding tens of thousands of worshippers, surrounded by the market stalls of booksellers and scholars, with students arriving from Mali, from Egypt, from the Ottoman east, and from the remnant Muslim communities of the Iberian Peninsula. He described professors teaching without payment, sustained by stipends from the sultan, and students living in attached residences maintained at public expense. The account is not systematic, and Leo was writing from memory, years after his capture, for a Roman audience that knew nothing of the city. But it remains the fullest picture available of Al-Qarawiyyin in its late medieval form.

What the Marinid sultans built around the mosque

The physical Al-Qarawiyyin that Leo Africanus described, and that survives today in altered form, owes its character largely to the Marinid dynasty, which ruled Fez from the mid-thirteenth to the mid-fifteenth century. Abu Said Uthman II, ruling in the early fourteenth century, added the ablution fountain that became one of the courtyard’s defining features. Abu al-Hasan Ali, who ruled from 1331 to 1348, funded an extensive renovation that enlarged the prayer hall and commissioned the carved plasterwork and cedarwood screens that remain the mosque’s most celebrated decorative elements.

The craftsmen who carried out this work are named in some Marinid-era sources: artisans from Fez itself, from Tlemcen in what is now western Algeria, and from the Andalusian cities. One craftsman, Ahmad ibn Muhammad al-Balaghithi, is recorded in a fragmentary source as having been involved in fourteenth-century work on the mosque, though the reference gives little further detail. The tiles that line the lower walls of the courtyard were produced in the city’s potters’ quarter by craftsmen whose names the record has not preserved. This is worth noting plainly: the history of Al-Qarawiyyin tends to recover the rulers and the scholars and to erase the people who cut the cedar and laid the tilework.

The library that Ibn Khaldun used was substantially organised and expanded under Abu Inan Faris in the mid-fourteenth century, who donated a significant number of manuscripts, several of which survive and can be consulted today.

The long survival and the question of continuity

Al-Qarawiyyin outlasted the Marinids, the Wattasids who succeeded them, and the first two centuries of Saadian rule. It survived the Portuguese occupation of the Moroccan coast, the disruptions of the sixteenth century, and the eventual consolidation of the Alaoui dynasty, which has ruled Morocco from 1631 to the present. Each dynasty found it politically useful to patronise the institution: control of Al-Qarawiyyin’s appointments and curriculum was a form of religious legitimacy, and no Moroccan ruler could afford to ignore it.

The formal integration of Al-Qarawiyyin into the Moroccan state university system occurred in 1963, under King Hassan II, and it is this moment that some scholars point to when questioning whether the institution’s claim to unbroken continuity is wholly accurate. The 1963 reform imposed a standardised curriculum and a modern degree structure on what had been, until that point, an institution operating by the principles of the traditional Islamic madrasa. Whether this represents a transformation of the institution or a modernisation of it is partly a question of definition. The prayer hall has been in continuous use since 859. The library’s manuscript holdings are continuous from the medieval period. The teaching function, in some form, has continued without interruption. By any reasonable measure, the institution that operates today in Fez is the direct descendant of what Fatima al-Fihri built.

Genealogy research note: what survives for researchers tracing ancestors connected to Al-Qarawiyyin

Researchers tracing scholars, students, craftsmen, or merchants connected to Al-Qarawiyyin face a more complex archival landscape than those working with European university records, but the resources that exist are substantial and, in some cases, poorly known outside specialist circles.

The Al-Qarawiyyin library in Fez holds approximately 4,000 manuscripts covering theology, law, history, mathematics, astronomy, and grammar. Many are unique copies. The library underwent a major restoration completed in 2016, directed by the architect Aziza Chaouni, and is now open to researchers by appointment. Digitisation is ongoing, though only a portion of the manuscripts are currently accessible remotely. The library holds some documents relating to institutional administration, including records of scholars and endowment donations, though these are not yet systematically catalogued in a form accessible to general genealogy researchers.

The Archives du Maroc (Moroccan National Archives) in Rabat hold administrative records from the Alaoui period (post-1631) that may include references to scholars, craftsmen, and merchants connected to Fez. These records are in Arabic and, for the earlier periods, in the Maghrebi script that requires specialist training to read. The archives’ finding aids are available in Arabic and French, and the archives can be contacted directly for research enquiries.

For researchers of Andalusian descent, the connection between Al-Qarawiyyin and the communities expelled from the Iberian Peninsula from the late fifteenth century onwards is genealogically significant. Many Andalusian families who resettled in Fez after 1492 are documented in Moroccan family genealogies, known as nasab records, held by descendants and in some cases by the Archives du Maroc. The Association Marocaine de Généalogie in Rabat may be able to assist researchers working in this area.

Researchers with family connections to West African Islamic scholarly traditions may find that Al-Qarawiyyin appears in the chains of scholarly transmission, known as silsilas, recorded in West African manuscripts. Many of these are held by the Ahmed Baba Institute in Timbuktu and are progressively being digitised through international partnership projects: the British Library and the University of Cape Town have both been involved in preservation and digitisation work on this collection.

The most immediately accessible resource for English-speaking researchers is the Encyclopaedia of Islam, available through most university library subscriptions, which contains detailed entries on the principal scholars associated with Al-Qarawiyyin with extensive bibliographies pointing toward primary sources.

Named individuals index for Al-Qarawiyyin history 859

NameDatesRole
Fatima al-Fihric.800–c.880Founder, Al-Qarawiyyin mosque and centre of learning, Fez
Muhammad al-Fihrid. before 859Merchant from Kairouan, Tunisia; Fatima’s father
Miriam al-Fihrifl. 859Fatima’s sister; founder of the Mosque of the Andalusians, Fez
Idris II791–828Ruler of Fez; received the Kairouanese emigrant community
Abu Imran al-Fasic.974–1038Maliki jurist; educated at Al-Qarawiyyin; teacher of the Almoravid reform movement
Yusuf ibn Tashfinc.1009–1106Almoravid ruler; made Fez an imperial capital
Abu al-Hasan Ali1297–1351Marinid sultan; funded major architectural renovation of Al-Qarawiyyin
Abu Inan Faris1329–1358Marinid sultan; expanded and donated to the library
Abu Said Uthman IIfl. early 14th centuryMarinid ruler; commissioned the courtyard ablution fountain
Ibn Khaldun1332–1406Historian and sociologist; used Al-Qarawiyyin’s library during his Fez years; author of the Muqaddimah
Gerbert of Aurillac (Pope Sylvester II)c.946–1003Frankish scholar; disputed connection to Andalusian and Maghrebi scholarship
Al-Hasan ibn Muhammad al-Wazzan (Leo Africanus)c.1494–c.1554Scholar educated in Fez; later described the city and Al-Qarawiyyin for European audiences
Ahmad ibn Muhammad al-Balaghithifl. 14th centuryCraftsman involved in Al-Qarawiyyin renovations (fragmentary record)
Aziza ChaounicontemporaryArchitect; led the 2016 Al-Qarawiyyin library restoration

Further reading on Al-Qarawiyyin history 859

Scroll to Top