In the old medina of Fez, behind carved doors and walls that have witnessed more than a millennium of Moroccan history, books have survived dynasties, wars, political upheavals and the arrival of printing. The library associated with al-Qarawiyyin is frequently introduced with a superlative: the oldest continuously operating library in the world.
The story is irresistible. It begins in 859 with a wealthy Muslim woman named Fatima al-Fihri, continues through centuries in which Fez became one of the great intellectual centers of the Islamic West, and reaches the present through a collection containing rare Qur'ans, works of law, theology, astronomy and medicine, and manuscripts connected with some of the most important scholars of the medieval Islamic world.
Yet the familiar version needs one important correction. Fatima al-Fihri is traditionally credited with founding the Qarawiyyin mosque in 859, from which a major center of teaching developed. The library as a distinct institution took shape over the centuries that followed. Saying that she simply “founded the world's oldest library in 859” compresses a long institutional history into a cleaner story than the evidence allows.
The reality is more interesting: al-Qarawiyyin did not appear fully formed as a modern university with an attached library. It grew.
A woman, a fortune and a mosque in ninth-century Fez
Fez was already becoming an important city when Fatima al-Fihri entered its history. According to the traditional account, her family had migrated from Kairouan, in present-day Tunisia, to Morocco. After inheriting wealth from her father, she devoted part of it to building a mosque for the community.
The Qarawiyyin — its name recalls the people of Kairouan — was founded in 245 AH, corresponding to 859 CE. UNESCO's General History of Africa identifies the Qarawiyyin at Fez as founded in 245/859, while UNESCO's description of the Medina of Fez notes the city's ninth-century origins and its association with what UNESCO calls the oldest university in the world.
Like many major mosques in the medieval Islamic world, the Qarawiyyin became more than a place of worship. Scholars taught there. Students gathered around teachers. Religious law, Arabic grammar, theology and other subjects formed part of an intellectual culture in which instruction was organized around scholars, texts and circles of learning rather than the departments and degree structures familiar from modern universities.
Over generations, the mosque expanded physically and intellectually. Rulers patronized it, scholars traveled to Fez, and manuscripts accumulated. What began as a religious foundation became one of North Africa's most enduring centers of scholarship.
Was it really the world's first university?
This question depends heavily on what the word university means.
UNESCO material describes Fez as home to the oldest university in the world, and al-Qarawiyyin is widely presented as the oldest continuously operating degree-granting educational institution. That formulation has made the site famous far beyond Morocco.
Historians, however, distinguish medieval Islamic centers of higher learning from the corporate university model that emerged in medieval Europe at places such as Bologna and Paris. The institutions had different legal structures, teaching traditions and systems of certification.
Calling al-Qarawiyyin the world's oldest university is therefore defensible under a broad definition of a continuously operating institution of advanced learning, but it should not imply that a ninth-century Moroccan mosque functioned exactly like a twenty-first-century university.
The same caution applies to the library. “Oldest working library” is a widely used description — including in Smithsonian's account of its modern restoration — but libraries evolve, move collections, close rooms, reorganize and change administrative structures. Superlatives depend on definitions.
What is beyond dispute is the extraordinary continuity of books, scholarship and learning at the Qarawiyyin complex across more than eleven centuries.
The library grew out of a culture of manuscripts
Before printing transformed the circulation of books, a library was an expensive intellectual machine. Every manuscript had to be copied by hand. Paper, parchment, ink and skilled labor all had value. A scholar's collection could represent decades of work, and a ruler's donation could substantially alter the resources available to students.
Fez became a major center of manuscript production and exchange. Successive dynasties, especially the Marinids, supported educational institutions and libraries. The Qarawiyyin collection expanded through donations, endowments and royal patronage.
Its holdings came to include works on Qur'anic studies, Islamic jurisprudence, hadith, language, philosophy, astronomy, medicine and mathematics. The collection reflects a world in which categories now separated into “religion,” “science” and “humanities” often coexisted within the education of the same scholar.
Among the library's celebrated treasures is a ninth-century Qur'an written in Kufic script on parchment. Smithsonian also reports that the collection includes an important copy of Ibn Khaldun's Muqaddimah, the great fourteenth-century introduction to history and society, along with exceptionally old works concerning the life and traditions of the Prophet Muhammad.
Claims that the library simply contains a large body of surviving ancient Greek manuscripts more than 1,100 years old should be treated cautiously. Greek philosophy and science profoundly influenced medieval Arabic intellectual culture through translation, commentary and adaptation, but the documented treasures of al-Qarawiyyin are primarily part of the Arabic and Islamic manuscript tradition. The story of Greek learning in the Islamic world is real; it does not require turning every famous Islamic library into a repository of original Greek codices.
Four keys once guarded the manuscripts
For centuries, access to rare manuscripts was not casual. Books could be unique objects, vulnerable to theft, fire, insects, humidity and physical wear.
One striking security tradition survived into modern memory. According to the library's curator, quoted by Smithsonian, the manuscript room once had a door secured by four locks. Four different people held the keys, meaning all four had to be physically present before the room could be opened.
It is an almost perfect image of how valuable the collection was considered. Before digital backups and mass-produced editions, losing a manuscript could mean losing a particular textual witness forever.
Yet locks could not solve the greatest long-term threat: the building itself was aging.
A modern architect was asked to save an ancient library
By the early twenty-first century, parts of the library had deteriorated badly. Temperature and humidity threatened manuscripts, structural elements needed repair, and the historic building required conservation compatible with modern preservation standards.
In 2012, Morocco's Ministry of Culture commissioned architect Aziza Chaouni, who was born in Fez, to lead a major restoration. Her team faced a delicate problem: modernize the infrastructure without erasing the character of a building embedded in one of the world's great historic medinas.
The project introduced climate-control and conservation systems while repairing roofs, wooden structures, tilework and other historic features. A laboratory was created to help conserve manuscripts, and parts of the restored complex were designed to make the institution more accessible than it had traditionally been.
The work was not merely architectural. Controlling moisture, temperature and light can determine whether a manuscript survives another century. A library more than a millennium into its history still depends on contemporary engineering.
Why the date 859 is both true and misleading
The date appears everywhere in stories about the library because it is powerful: 859 makes al-Qarawiyyin older than the University of Bologna, Oxford University and almost every famous European institution of higher learning.
But the date belongs most securely to the foundation of the Qarawiyyin mosque. Teaching developed around it, and the library emerged as part of the expanding scholarly institution.
This is not unusual. Many of the world's oldest institutions do not have a single birthday in the modern sense. A monastery acquires a scriptorium; a mosque develops teaching circles; collections donated by rulers become organized libraries; schools acquire legal identities generations after teaching begins.
Institutional history is often gradual.
Fatima al-Fihri's importance does not depend on pretending that she opened a modern library with shelves and membership cards in 859. The remarkable fact is that a religious foundation traditionally associated with a ninth-century woman became the nucleus of an intellectual institution whose influence and collections survived for more than a thousand years.
The survival of a manuscript is its own historical miracle
A book produced in the ninth or tenth century has lived a dangerous life.
It has survived humidity, insects, fire, political instability, careless handling and the simple chemical decay of its materials. It may have passed through several owners before reaching a collection. Its text may have been copied repeatedly, each copy becoming another branch in the history of the work.
Libraries such as al-Qarawiyyin matter because they preserve not merely the words of old authors but physical evidence about how knowledge traveled. Handwriting, marginal notes, corrections, ownership marks and bindings can tell historians who read a work, how it was taught and how texts changed over time.
A medieval manuscript is simultaneously a container of information and an archaeological object.
That makes the continued existence of the Qarawiyyin collection especially striking. Fez itself has changed governments, economies and technologies many times since the ninth century. The Medina of Fez has been a UNESCO World Heritage property since 1981, recognized as one of the best-preserved historic cities of the Arab-Muslim world.
Within that urban fabric, the Qarawiyyin remains connected to the activity that gave it significance in the first place: learning.
The real record is continuity
Arguments over whether al-Qarawiyyin is precisely the world's oldest university, oldest library or oldest continuously operating institution can become exercises in definitions. Other ancient libraries and educational traditions have their own claims, interruptions and institutional transformations.
The more meaningful fact is harder to compress into a record-book label.
In 859, a mosque was founded in Fez and tradition remembers Fatima al-Fihri as the woman who financed it. Scholars gathered there. Teaching endured. Manuscripts accumulated. Dynasties expanded the institution. A library emerged and preserved works across centuries. In the twenty-first century, architects and conservators installed modern systems so that those same intellectual traditions could continue.
The technology of knowledge has changed almost beyond recognition. A ninth-century manuscript had to be copied by hand; today a digital image can cross the planet in seconds. Yet the underlying task remains familiar: preserve what previous generations learned and make it available to the next.
That is the most extraordinary thing about al-Qarawiyyin. Its story is not simply that something very old survived. It is that, for more than eleven centuries, people kept deciding that the knowledge inside was worth saving.