University of al-Qarawiyyin

The University of al-Qarawiyyin (Arabic: جامعة القرويين, romanized: Jāmiʻat al-Qarawīyīn), also written Al-Karaouine or Al Quaraouiyine, is a university located in Fez, Morocco. It was founded as a mosque by Fatima al-Fihri in 857–859 and subsequently became one of the leading spiritual and educational centers of the Islamic Golden Age. It was incorporated into Morocco's modern state university system in 1963 and officially renamed "University of Al Quaraouiyine" two years later. The mosque building itself is also a significant complex of historical Moroccan and Islamic architecture that features elements from many different periods of Moroccan history. Scholars consider al-Qarawiyyin to have been effectively run as a madrasa until after World War II. Many scholars distinguish this status from the status of "university", which they view as a distinctly European invention. They date al-Qarawiyyin's transformation from a madrasa into a university to its modern reorganization in 1963. UNESCO and the Guinness World Records, have cited al-Qarawiyyin as the oldest university or oldest continually operating higher learning institution in the world.
Education at the University of al-Qarawiyyin concentrates on the Islamic religious and legal sciences with a heavy emphasis on, and particular strengths in, Classical Arabic grammar/linguistics and Maliki Sharia, though lessons on non-Islamic subjects are also offered to students. Teaching is still delivered in the traditional methods. The university is attended by students from all over Morocco and Muslim West Africa, with some also coming from further abroad. Women were first admitted to the institution in the 1940s.
The Arabic name of the university means "University of the People from Kairouan". Factors such as the provenance of Fatima al-Fihriya's family in Tunisia, the presence of the letter Qāf (ق) – a voiceless uvular plosive which has no equivalent in European languages – the ويّي ([awijiː]) triphthong in the university's name, and the French colonization of Morocco have resulted in a number of different orthographies for the romanization of the university's name, including al-Qarawiyyin, a standard anglicization; Al Quaraouiyine, following French orthography; and Al-Karaouine, another rendering using French orthography.
In the 9th century, Fez was the capital of the Idrisid dynasty, considered to be the first Moroccan Islamic state. According to one of the major early sources on this period, the Rawd al-Qirtas by Ibn Abi Zar, al-Qarawiyyin was founded as a mosque in 857 or 859 by Fatima al-Fihri, the daughter of a wealthy merchant named Mohammed al-Fihri. The al-Fihri family had migrated from Kairouan (hence the name of the mosque), Tunisia to Fez in the early 9th century, joining a community of other migrants from Kairouan who had settled in a western district of the city. Fatima and her sister Mariam, both of whom were well educated, inherited a large amount of money from their father. Fatima vowed to spend her entire inheritance to build a mosque suitable for her community. Similarly, her sister Mariam is also reputed to have founded al-Andalusiyyin Mosque the same year.
This foundation narrative has been questioned by some modern historians who see the symmetry of two sisters founding the two most famous mosques of Fez as too convenient and likely originating from a legend. Ibn Abi Zar is also judged by contemporary historians to be a relatively unreliable source. One of the biggest challenges to this story is a foundation inscription that was rediscovered during renovations to the mosque in the 20th century, previously hidden under layers of plaster for centuries. This inscription, carved onto cedar wood panels and written in a Kufic script very similar to foundation inscriptions in 9th-century Tunisia, was found on a wall above the probable site of the mosque's original mihrab (prior to the building's later expansions). The inscription, recorded and deciphered by Gaston Deverdun, proclaims the foundation of "this mosque" (Arabic: "هذا المسجد") by Dawud ibn Idris (a son of Idris II who governed this region of Morocco at the time) in Dhu al-Qadah 263 AH (July–August of 877 CE). Deverdun suggested the inscription may have come from another unidentified mosque and was moved here at a later period (probably 15th or 16th century) when the veneration of the Idrisids was resurgent in Fez, and such relics would have held enough religious significance to be reused in this way. However, Chafik Benchekroun argued more recently that a more likely explanation is that this inscription is the original foundation inscription of al-Qarawiyyin itself and that it might have been covered up in the 12th century just before the Almohads' arrival in the city. Based on this evidence and on the many doubts about Ibn Abi Zar's narrative, he argues that Fatima al-Fihri is quite possibly a legendary figure rather than a historical one. Péter T. Nagy has also stated that the uncovered foundation inscription is more convincing evidence of the mosque's original foundation date than the traditional historiographical narrative.
Some scholars suggest that some teaching and instruction probably took place at al-Qarawiyyin Mosque from a very early period or from its beginning. Major mosques in the early Islamic period were typically multi-functional buildings where teaching and education took place alongside other religious and civic activities. The al-Andalusiyyin Mosque, in the district across the river, may have also served a similar role up until at least the Marinid period, though it never equaled the Qarawiyyin's later prestige. It is unclear at what time al-Qarawiyyin began to act more formally as an educational institution, partly because of the limited historical sources that pertain to its early period. The most relevant major historical texts like the Rawd al-Qirtas by Ibn Abi Zar and the Zahrat al-As by Abu al-Hasan Ali al-Jazna'i do not provide any clear details on the history of teaching at the mosque, though al-Jazna'i (who lived in the 14th century) mentions that teaching had taken place there before his time. Otherwise, the earliest mentions of halaqa (circles) for learning and teaching may not have been until the 10th or the 12th century. Historian Abdelhadi Tazi indicates the earliest clear evidence of teaching at al-Qarawiyyin in 1121. Moroccan historian Mohammed Al-Manouni believes that the mosque acquired its function as a teaching institution during the reign of the Almoravids (1040–1147). Historian Évariste Lévi-Provençal dates the beginning of teaching to the Marinid period (1244–1465).
In the 10th century, the Idrisid dynasty fell from power and Fez was contested between the Fatimid and Córdoban Umayyad caliphates and their allies. During this period, the Qarawiyyin Mosque progressively grew in prestige. At some point the khutba (Friday sermon) was transferred from the Shurafa Mosque of Idris II (today the Zawiya of Moulay Idris II) to the Qarawiyyin Mosque, granting it the status of Friday mosque (the community's main mosque). This transfer happened either in 919 or in 933, both dates that correspond to brief periods of Fatimid domination over the city, and suggests that the transfer may have occurred by Fatimid initiative. The mosque and its learning institution continued to enjoy the respect of political elites, with the mosque itself being significantly expanded by the Almoravids and repeatedly embellished under subsequent dynasties. Tradition was established that all the other mosques in Fez based the timing of their call to prayer (adhan) according to that of al-Qarawiyyin.
Many scholars consider al-Qarawiyyin's high point as an intellectual and scholarly center to be in the 13th and 14th centuries, when the curriculum was at its broadest and its prestige had reached new heights after centuries of expansion and elite patronage. Among the subjects taught around this period or shortly after were traditional religious subjects such as the Quran and fiqh (Islamic jurisprudence), and other sciences like grammar, rhetoric, logic, medicine, mathematics, astronomy and geography. By contrast, some subjects like alchemy/chemistry were never officially taught as they were considered too unorthodox.
Starting in the late 13th century, and especially in the 14th century, the Marinid dynasty was responsible for constructing a number of formal madrasas in the areas around al-Qarawiyyin's main building. The first of these was the Saffarin Madrasa in 1271, followed by al-Attarine in 1323, and the Mesbahiya Madrasa in 1346. A larger but much later madrasa, the Cherratine Madrasa, was also built nearby in 1670. These madrasas taught their own courses and sometimes became well-known institutions, but they usually had narrower curricula or specializations. One of their most important functions seems to have been to provide housing for students from other towns and cities – many of them poor – who needed a place to stay while studying at al-Qarawiyyin. Thus, these buildings acted as complimentary or auxiliary institutions to al-Qarawiyyin itself, which remained the center of intellectual life in the city.
Al-Qarawiyyin also compiled a large selection of manuscripts that were kept at a library founded by the Marinid sultan Abu Inan Faris in 1349. The collection housed numerous works from the Maghreb, al-Andalus, and the Middle East. Part of the collection was gathered decades earlier by Sultan Abu Yusuf Ya'qub (ruled 1258–1286), who persuaded Sancho IV of Castile to hand over a number of works from the libraries of Seville, Córdoba, Almeria, Granada, and Malaga in al-Andalus/Spain. Abu Yusuf initially housed these in the nearby Saffarin Madrasa (which he had recently built), but later moved them to al-Qarawiyyin. Among the most precious manuscripts currently housed in the library are volumes from the Al-Muwatta of Malik written on gazelle parchment, a copy of the Sirat by Ibn Ishaq, a 9th-century Quran manuscript (also written on gazelle parchment), a copy of the Quran given by Sultan Ahmad al-Mansur in 1602, a copy of Ibn Rushd's Al-Bayan Wa-al-Tahsil wa-al-Tawjih (a commentary on Maliki fiqh) dating from 1320, and the original copy of Ibn Khaldun's book Al-'Ibar (including the Muqaddimah) gifted by the author in 1396. Recently rediscovered in the library is an ijazah certificate, written on deer parchment, which some scholars claim to be the oldest surviving predecessor of a Medical Doctorate degree, issued to a man called Abdellah Ben Saleh Al Koutami in 1207 CE under the authority of three other doctors and in the presence of the chief qadi (judge) of the city and two other witnesses. The library was managed by a qayim or conservator, who oversaw the maintenance of the collection. By 1613 one conservator estimated the library's collection at 32,000 volumes.
Students were male, but traditionally it has been said that "facilities were at times provided for interested women to listen to the discourse while accommodated in a special gallery (riwaq) overlooking the scholars' circle". The 12th-century cartographer Mohammed al-Idrisi, whose maps aided European exploration during the Renaissance, is said to have lived in Fez for some time, suggesting that he may have worked or studied at al-Qarawiyyin. The institution has produced numerous scholars who have strongly influenced the intellectual and academic history of the Muslim world. Among them are Ibn Rushayd al-Sabti (d. 1321), Mohammed Ibn al-Hajj al-Abdari al-Fasi (d. 1336), Abu Imran al-Fasi (d. 1015) – a leading theorist of the Maliki school of Islamic jurisprudence, and Leo Africanus. Pioneer scholars such as Muhammad al-Idrissi (d.1166 AD), Ibn al-Arabi (1165–1240 AD), Ibn Khaldun (1332–1395 AD), Ibn al-Khatib (d. 1374), Nur ad-Din al-Bitruji (Alpetragius) (d. 1294), and Ali ibn Hirzihim (d. 1163) were all connected with al-Qarawiyyin as either students or lecturers. Some Christian scholars visited al-Qarawiyyin, including Nicolas Cleynaerts (d. 1542) and the Jacobus Golius (d. 1667). The 19th-century orientalist Jousé Ponteleimon Krestovitich also claimed that Gerbert d'Aurillac (later Pope Sylvester II) studied at al-Qarawiyyin in the 10th century. Although this claim about Gerbert is sometimes repeated by modern authors, modern scholarship has not produced evidence to support this story.
Al-Qarawiyyin underwent a general decline in later centuries along with Fez. The strength of its teaching stagnated and its curriculum decreased in range and scope, becoming focused on traditional Islamic sciences and Arabic linguistic studies. Even some traditional Islamic specializations like tafsir (Quranic exegesis) were progressively neglected or abandoned. In 1788–89, the 'Alawi sultan Muhammad ibn Abdallah introduced reforms that regulated the institution's program, but also imposed stricter limits and excluded logic, philosophy, and the more radical Sufi texts from the curriculum. Other subjects also disappeared over time, such as astronomy and medicine. In 1845 Sultan Abd al-Rahman carried out further reforms, but it is unclear if this had any significant long-term effects. Between 1830 and 1906 the number of faculty decreased from 425 to 266 (of which, among the latter, only 101 were still teaching).
By the 19th century, the mosque's library also suffered from decline and neglect. A significant portion of its collection was lost over time, most likely due to lax supervision and to books that were not returned. By the beginning of the 20th century, the collection had been reduced to around 1,600 manuscripts and 400 printed books, though many valuable historic items were retained.
By the late 19th century, Western scholars began to recognize al-Qarawiyyin as a "university", a description which would become more established during the French protectorate period in the 20th century.
At the time Morocco became a French protectorate in 1912, al-Qarawiyyin worsened as a religious center of learning from its medieval prime, though it retained some significance as an educational venue for the sultan's administration. The student body was rigidly divided along social strata: ethnicity (Arab or Berber), social status, personal wealth, and geographic background (rural or urban) determined the group membership of the students who were segregated by the teaching facility, as well as in their personal quarters.
The French administration implemented a number of structural reforms between 1914 and 1947, including the institution of calendars, appointment of teachers, salaries, schedules, general administration, and the replacement of the ijazah with the shahada alamiyha, but did not modernize the contents of teaching likewise which were still dominated by the traditional worldviews of the ulama. At the same time, the student numbers at al-Qarawiyyin decreased to 300 in 1922 as the Moroccan elite sent their children to the newly founded Western-style colleges and institutes elsewhere in the country. Moroccan and French authorities began planning further reforms for al-Qarawiyyin in 1929. In 1931 and 1933, on the orders of Muhammad V, the institution's teaching was reorganized into elementary, secondary, and higher education.
Al-Qarawiyyin also played a role in the Moroccan nationalist movement and in protests against the French colonial regime. Many Moroccan nationalists had received their education here and some of their informal political networks were established due to the shared educational background. In July 1930, al-Qarawiyyin strongly participated in the propagation of Ya Latif, a communal prayer recited in times of calamity, to raise awareness and opposition to the Berber Dahir decreed by the French authorities two months earlier. In 1937 the mosque was one of the rallying points (along with the nearby R'cif mosque) for demonstrations in response to a violent crackdown on Moroccan protesters in Meknes, which ended with French troops being deployed across Fes el-Bali and at the mosques.
In 1947, al-Qarawiyyin was integrated into the state educational system, and women were first admitted to study there during the 1940s. In 1963, after Moroccan independence, al-Qarawiyyin was officially transformed by royal decree into a university under the supervision of the ministry of education. Classes at the old mosque ceased and a new campus was established at a former French Army barracks. While the dean took his seat at Fez, four faculties were founded in and outside the city: a faculty of Islamic law in Fez, a faculty of Arab studies in Marrakech, and two faculties of theology in Tétouan and near Agadir. Modern curricula and textbooks were introduced and the professional training of the teachers improved. Following the reforms, al-Qarawiyyin was officially renamed "University of Al Quaraouiyine" in 1965.
In 1975, General Studies was transferred to the newly founded Sidi Mohamed Ben Abdellah University; al-Qarawiyyin kept the Islamic and theological courses of studies. In 1973, Abdelhadi Tazi published a three-volume history of the establishment entitled جامع القرويين (The al-Qarawiyyin Mosque).
In 1988, after a hiatus of almost three decades, the teaching of traditional Islamic education at al-Qarawiyyin was resumed by King Hassan II in what has been interpreted as a move to bolster conservative support for the monarchy.
Education at al-Qarawiyyin University concentrates on the Islamic religious and legal sciences with a heavy emphasis on, and particular strengths in, Classical Arabic grammar/linguistics and Maliki law, though some lessons on other non-Islamic subjects such as French and English are also offered to students. Teaching is delivered with students seated in a semi-circle around a sheikh, who prompts them to read sections of a particular text; asks them questions on particular points of grammar, law, or interpretation; and explains difficult points. Students from Morocco and Islamic West Africa attend al-Qarawiyyin, though some come from Muslim Central Asia. Spanish Muslim converts frequently attend the institution, largely attracted by the fact that the sheikhs of al-Qarawiyyin, and Islamic scholarship in Morocco in general, are heirs to the rich, religious, and scholarly heritage of Muslim al-Andalus.
Most students at al-Qarawiyyin range are between 13 and 30 years old, and study towards high school-level diplomas and university-level bachelor's degrees, although Muslims with a sufficiently high level of Arabic can attend lecture circles on an informal basis, given the traditional category of visitors "in search of [religious and legal] knowledge". In addition to being Muslim, prospective students of al-Qarawiyyin are required to have fully memorized the Quran, as well as other shorter medieval Islamic texts on grammar and Maliki law, and to be proficient in classical Arabic.
Al-Qarawiyyin Mosque was founded in the 9th century, but its present form is the result of a long historical evolution over the course of more than 1,000 years. Successive dynasties expanded the mosque until it became the largest in Africa, with a capacity of 22,000 worshipers. The present-day mosque covers an extensive area of about half a hectare. Broadly speaking, it consists of a large hypostyle interior space for prayers (the prayer hall), a courtyard with fountains (the sahn), a minaret at the courtyard's western end, and a number of annexes around the mosque itself.
The original mosque building was built in the 9th century. A major modern study of the mosque's structure, published by French archeologist and historian Henri Terrasse in 1968, determined that traces of the original mosque could be found in the layout of the current building. This initial form of the mosque occupied a large space immediately to the south of the sahn, in what is now the prayer hall. It had a rectangular floor plan measuring 36 by 32 meters, covering an area of 1520 square meters, and was composed of a prayer hall with four transverse aisles running roughly east–west, parallel to the southern qibla wall. It probably also had a courtyard of relatively small size, and the first minaret, also of small size, reportedly stood on the location now occupied by the wooden anaza (at the central entrance to the prayer hall from the courtyard). Water for the mosque was initially provided by a well dug within the mosque's precinct.
As Fez grew and the mosque increased in prestige, the original building was insufficient for its religious and institutional needs. During the 10th century, the Umayyad Caliphate of Córdoba and the Fatimid Caliphate constantly fought for control over Fez and Morocco, seen as a buffer zone between the two. Despite this uncertain period, the mosque received significant patronage and had its first expansions. The Zenata Berber emir Ahmed ibn Abi Said, one of the rulers of Fez during this period who was aligned with the Umayyads, wrote to the caliph Abd al-Rahman III in Córdoba for permission and funds to expand the mosque. The caliph approved, and the work was carried out or completed in 956. It expanded the mosque on three sides, encompassing the area of the present-day courtyard to the north and up to the current eastern and western boundaries of the building. It also replaced the original minaret with a new, larger minaret still standing today. Its overall form, with a square shaft, was indicative of the subsequent development of Maghrebi and Andalusian minarets.
The mosque was embellished when the Amirid ruler al-Muzaffar (son of al-Mansur) led a military expedition to Fez in 998. The embellishments included a new minbar and a dome topped by talismans in the shape of a rat, a serpent, and a scorpion. Of these, only the dome itself, whose exterior is distinctively fluted or grooved, survives today, located above the courtyard entrance to the prayer hall. A similar dome, located across the courtyard over the northern entrance of the mosque (Bab al-Ward or "Gate of the Rose"), likely also dates from the same time.
One of the most significant expansions and renovations was carried out between 1134 and 1143 under the patronage of the Almoravid ruler Ali ibn Yusuf. The prayer hall was extended by dismantling the existing southern wall and adding three more transverse aisles for a total of ten, while replicating the format of the existing arches of the mosque. This expansion required the purchase and demolition of a number of neighboring houses and structures, including some that were apparently part of the nearby Jewish neighbourhood (before the Mellah of Fez).
The new expansion of the mosque involved not only a new mihrab in the middle of the new southern wall, but also the reconstruction or embellishment of the prayer hall's central nave (the arches along its central axis, in a line perpendicular to the southern wall and to the other rows of arches) leading from the courtyard to the mihrab. This involved not only embellishing some of the arches with new forms but also adding a series of highly elaborate cupola ceilings composed in muqarnas (honeycomb or stalactite-like) sculpting and further decorated with intricate reliefs of arabesques and Kufic letters. The craftsmen who worked on this expansion are mostly anonymous, except for two names that are carved on the bases of two of the cupolas: Ibrāhīm and Salāma ibn Mufarrij, who may have been of Andalusi origin. Lastly, a new minbar in similar style and of similar artistic provenance as the minbar of the Koutoubia Mosque was completed and installed in 1144. It is made of wood in an elaborate work of marquetry, and decorated with inlaid materials and intricately carved arabesque reliefs. Its style was emulated for later Moroccan minbars.
Elsewhere, many of the mosque's main entrances were given doors made of wood overlaid with ornate bronze fittings, which today count among the oldest surviving bronze artworks in Moroccan architecture. Another interesting element added to the mosque was a small secondary oratory, known as the Jama' al-Gnaiz ("Funeral Mosque" or "Mosque of the Dead"), which was separated from the main prayer hall and dedicated to providing funerary rites for the deceased before their burial. The annex is also decorated with a muqarnas cupola and ornate archways and windows.
Later dynasties continued to embellish the mosque or gift it with new furnishings, though no works as radical as the Almoravid expansion were undertaken again. The Almohads (later 12th century and 13th century) conquered Fez after a long siege in 1145–1146. Historical sources (particularly the Rawd al-Qirtas) report a story claiming that the inhabitants of Fez, fearful that the "puritan" Almohads would resent the lavish decoration placed inside the mosque, used whitewash to cover up the most ornate decorations from Ibn Yusuf's expansion near the mihrab. Terrasse suggests this operation may have actually been carried out a few years later by the Almohad authorities themselves. The Almoravid ornamentation was only fully uncovered again during renovations in the early 20th century. The plaster used to cover the Almoravid decoration seems to have been prepared too quickly and did not fully bond with the existing surface. This ended up making its removal easier during modern restorations and has helped to preserve much of the original Almoravid decoration now visible again today.
Under the reign of Muhammad al-Nasir (r. 1199–1213), the Almohads added and upgraded a number of elements in the mosque, some of which were nonetheless marked with strong decorative flourishes. The ablutions facilities in the courtyard were upgraded, a separate ablutions room was added to the north, and a new underground storage room was created. They also replaced the mosque's grand chandelier with one made of bronze, which Terrasse described as "the largest and most beautiful chandelier in the Islamic world," and which hangs in the central nave of the mosque today. It was commissioned by Abu Muhammad 'Abd Allah ibn Musa, the khatib of the mosque during the years 1202 to 1219. The chandelier has the shape of a 12-sided cupola surmounted by a large cone, around which are nine levels that hold candlesticks. It could originally hold 520 oil candles; the cost of providing the oil was so significant that it was only lit on special occasions, such as on the nights of Ramadan. The Marinid sultan Abu Ya'qub Yusuf (r. 1286–1307), upon seeing the cost, ordered that it only be lit for the last day of Ramadan. The visible surfaces of the chandelier are carved and pierced with intricate floral arabesque motifs as well as Kufic Arabic inscriptions. The chandelier is the oldest surviving chandelier in the western Islamic world, and it likely served as a model for the Marinid chandelier in the Great Mosque of Taza.
The Marinids, who were responsible for building many of the madrasas around Fez, made various contributions to the mosque. In 1286 they restored and protected the 10th-century minaret, which had been made from deteriorating poor-quality stone with whitewash. At its southern foot, they also built the Dar al-Muwaqqit, a chamber for the timekeeper (muwaqqit) of the mosque who was responsible for determining the precise times of prayer. The chamber was equipped with astrolabes and other scientific equipment of the era in order to aid in this task. Several water clocks were built for it in this period. The first two do not exist anymore, but are described by al-Jazna'i in the Zahrat al-As. The first was commissioned by Abu Yusuf Ya'qub in the 13th century and designed by Muhammad ibn al-Habbak, a faqih and muwaqqit. The second was built in 1317 or 1318 (717 AH), under the reign of Abu Sa'id, by a scholar named Abu Abdullah Muhammad al-Sanhaji. Its time divisions were engraved by Abu Abdullah Muhammad ibn al-Saddina al-Qarsatuni. The clock was neglected then restored between 1346 and 1349 (747–749 AH) by a new muwaqqit, Abu Abdullah Muhammad ibn al-'Arabi. A third and final water clock, built on the orders of Sultan Abu Salim Ali II (ruled 1359–1361), is still partly preserved today. It was designed by Abu Zayd Abd al-Rahman ibn Sulayman al-Laja'i and completed on November 20, 1361 (21 Muharram 763 AH), as recorded by an original inscription. It features a large astrolabe with a diameter of 71 cm, which is embedded into a wooden structure in the corner of the room, but its mechanism is no longer present.
The galleries around the sahn were also rebuilt or repaired in 1283 and 1296–97, while at the entrance from the courtyard to the prayer hall (leading to the central nave of the mihrab), a decorative wooden screen, called the anaza, was installed in 1289 and acted as a symbolic "outdoor" or "summer" mihrab for prayers in the courtyard. The stucco decoration on the entrance arch itself, however, dates from much later. At the central outer entrance to the courtyard from the north, the cupola ceiling over the entrance vestibule of the gate called Bab al-Ward ("Gate of the Rose") was redecorated with carved stucco in 1337. The richly-sculpted archway on the inner side of the gate also dates from this time.
A number of ornate metal chandeliers hanging in the mosque's prayer hall date from the Marinid era. Three of them were made from church bells which Marinid craftsmen used as a base onto which they grafted ornate copper fittings. The largest of them, installed in the mosque in 1337, was a bell brought back from Gibraltar by the son of Sultan Abu al-Hasan, Abu Malik, after its reconquest from Spanish forces in 1333.
The mosque's library was officially founded by Sultan Abu Inan in 1349 (750 AH), as dated by an inscription over its doorway. This first Marinid library was located at the mosque's northeastern corner (as opposed to the library's current southern location). In 1361, Sultan Abu Salim added a room to it, which was built above and over the adjacent street, and dedicated to readings of the Quran.
The Saadians embellished the mosque by adding two prominent pavilions to the western and eastern ends of the courtyard, each of which sheltered a new fountain. The Saadian sultan Ahmad al-Mansur was responsible for building the first pavilion to the east in 1587–88, while the western pavilion was added by his grandson Abdallah al-Ghalib II in 1609. The pavilions emulate the ones in the Court of Lions of the Alhambra palaces (in Granada, Spain). Al-Mansur also built a new room for the library on the south side of the mosque (around the library's current location), which was connected to the mosque via a door in the qibla wall.
The 'Alawi dynasty, which has ruled Morocco from the 17th century onward (less 1912-1956 when Morocco was a part of France), continued to perform minor additions and regular maintenance on the mosque. A ribbed cupola in the central nave, where the 1337 Marinid chandelier hangs, has been dated by Terrasse to the 'Alawi period, although Xavier Salmon has more recently argued that at least some elements of the dome seem to date from the Marinid era. The stucco decoration of the central archway at the courtyard entrance to the prayer hall (i.e. the arch inside which the Marinid-era anaza stands) also dates from the 'Alawi period; an inscription at the top of the arch gives the year 1864–1865 (1281 AH).
The present library building dates mainly from a major expansion and modification in the 20th century, particularly in the 1940s. The new library expansion, which included a large new reading room, was inaugurated in 1949.
Al-Qarawiyyin's exterior does not generally present a monumental appearance and is integrated with the dense urban fabric around it. By one count there are 18 separate gates and entrances distributed around its perimeter. The gates vary from small rectangular doorways to enormous horseshoe arches with huge doors preceded by wooden roofs covering the street in front of them. While the doors are generally made of wood, some of the gates have extensive ornate bronze overlays crafted during the Almoravid period. The most ornate and best-preserved examples include the doors of the principal northern gate, Bab al-Ward (which opens onto the courtyard), the western gate called Bab Sbitriyyin, and the southwestern gate Bab al-Gna'iz, which leads to the Jama' al-Gna'iz. While the doors of Bab al-Ward preserve original pieces and were restored in 2005–2007, the doors of Bab al-Gna'iz and Bab Sbitriyyin are replicas made in the 1950s that replaced the originals, whose fragments are kept by the Dar Batha Museum. The northwestern gates of the mosque, Bab al-Shama'in (or Bab Chemaine) and Bab al-Maqsura, also have heavy bronze fittings, including some ornate knockers that date from the Almoravid period.
Adjacent to Bab al-Ward, on its west side, is another doorway, Bab al-Hafa ("Gate of the Barefooted"). This gate dates to the Almohad era. It is distinguished by a small water channel that runs across the floor just inside it. The channel allowed worshipers entering the mosque to wash their feet on the way in, helping with initial ablutions.
Next to the mosque is a tower known as the Borj Neffara (برج النفارة, "Tower of the Trumpeters"), an observation tower that is sometimes confused as a minaret but was actually part of another Dar al-Muwaqqit.
The interior hypostyle prayer hall takes up most of the mosque's area. Like the interior of most traditional mosques in Moroccan architecture, it is a relatively austere space with mostly plain walls, wooden roofs, and rows upon rows of arches. The main area, south of the courtyard, is a vast space divided into ten transverse aisles by rows of arches running parallel to the southern wall. The southern wall of this hall also marks the qibla. The central axis of the prayer hall, perpendicular to the qibla wall, is marked by a central nave running between two extra lines of arches along this axis, perpendicular to the other arches. This nave leads towards the mihrab: a niche in the qibla wall which symbolizes the direction of prayer, and in front of which the imam usually leads prayers and delivers sermons. This overall layout (a hypostyle hall with a central nave emphasized against the others) is a familiar layout for North African mosques generally.
The mihrab, which dates from the Almoravid (12th-century) expansion, is decorated with carved and painted stucco, as well as several windows of coloured glass. The mihrab niche itself is a small alcove which is covered by a small dome of muqarnas (stalactite or honeycomb-like sculpting). On each side of the mihrab's opening is a pair of engaged marble columns topped by deeply-carved capitals. These capitals are spolia from al-Andalus, dating from the time of the Caliphate of Córdoba, which were re-appropriated by the Almoravids for Ali Ibn Yusuf's expansion of the mosque. On the mihrab's façade, the stucco ornamentation of the lower parts, immediately around the arch itself, was most likely redone in the 18th and/or early 19th centuries. The stucco decoration of the upper wall above this still dates from the Almoravid period. The Almoravid decoration prioritizes floral motifs, which contain more diversity than the later restorations below, over which bands of Kufic inscriptions have also been carved.
The central nave that runs along the axis of the mihrab is distinguished from the rest of the mosque by a number of architectural embellishments. The arches that run along it are of varying shapes, including both horseshoe arches and multi-lobed arches. Instead of the plain timber ceilings, most sections of the nave are covered by a series of intricate muqarnas ceilings and cupolas, each slightly different from the other, as well as two "ribbed" dome cupolas (similar to the domes of the Great Mosque of Córdoba and Cristo de la Luz Mosque in Toledo) dating from the Almoravid and 'Alawi periods. The muqarnas vaults are made of plaster and are suspended from a hidden framework of wooden struts above them. Many of the muqarnas compositions are further embellished with intricate reliefs of arabesques and Arabic inscriptions in both Kufic and cursive letters, highlighted with blue and red colours. Additionally, there are several elaborately carved bronze chandeliers hanging in the nave which were gifted to the mosque during the Almohad and Marinid eras; at least three of which were made from bells (probably church bells) brought back from victories in Spain.
To the right of the mihrab is the minbar of the mosque, which could also be stored in a small room behind a door in the qibla wall. The minbar is most likely of similar origins as the Almoravid minbar of the Koutoubia Mosque, made by a workshop in Córdoba not long after the latter and installed in al-Qarawiyyin Mosque in 1144 (at the end of the Almoravid works on the mosque). It is another exceptional work of marquetry and woodcarving, decorated with geometric compositions, inlaid materials, and arabesque reliefs.
Aside from the embellishments of the central nave, the rest of the mosque is architecturally uniform, but there are some minor irregularities in the floor plan. For example, the arches in the western half of the prayer hall are shorter than those in the eastern half, and some of the transverse aisles are slightly wider than others. These anomalies have not been fully explained but they appear to have been present since the early centuries of the mosque; they may be due to early reconstructions or alterations which have gone unrecorded in historical chronicles.
The courtyard (sahn) is rectangular, surrounded by the prayer hall on three sides and by a gallery to the north. The floor is paved with typical Moroccan mosaic tiles (zellij) and at the center is a fountain. From outside the mosque, the courtyard is accessed by the main northern gate, called Bab al-Ward, whose vestibule is covered by a Marinid-era white dome which is fluted on the outside and covered in painted and carved stucco on the inside. Opposite this gate, situated on the mihrab axis, is the central entrance to the interior prayer hall, guarded by a carved and painted wooden screen called the anaza which also acted as a symbolic "outdoor" or "summer" mihrab for prayers taking place in the courtyard. (These features are visible to visitors standing outside the gate.) Both this entrance to the prayer hall and the outer gate across from it have facades decorated with carved and painted stucco.
At the western and eastern ends of the courtyard stand two ornate Saadian pavilions each sheltering another fountain. The pavilions have pyramidal domes and emulate the pavilions in the Court of the Lions in the Alhambra (Spain). They are decorated with carved wood and stucco, mosaic-tiled walls, and marble columns. Behind these pavilions are extensions of the main prayer hall divided into four naves by rows of arches. The gallery and arched hall on the northeastern sides of the courtyard are a prayer space reserved for women.
The minaret was constructed in the 10th century under the sponsorship of the Umayyad caliph of Córdoba, Abd al-Rahman III. It overlooks the courtyard from the west. Along with the contemporary minaret of the Mosque of the Andalusians, it is the oldest preserved minaret in Morocco. It was constructed in local limestone of relatively poor quality and was covered in whitewash by the Marinids in the 13th century in order to protect it from deterioration. It has a square shaft and is topped by a dome, as well as a parapet from which the muezzin historically issued the call to prayer (adhan). The full structure is 26.75 meters tall. One feature of the minaret is the lower window on its southern facade, which is shaped like a "triple" horseshoe arch, elongated vertically, which is unique to this structure. On the minaret's southern side, just above the gallery of the courtyard, is the Dar al-Muwaqqit.
A number of annexes are attached around the mosque, serving various functions. The northwestern edge of the building is occupied by latrines. Behind the southern qibla wall, to the west of the mihrab axis, is the Jama' al-Gnaiz, which served as a separate oratory reserved for funerary rites. This type of facility was not particularly common in the Islamic world but there are several examples in Fez, including at the Chrabliyine and Bab Guissa Mosques. It was kept separate from the main mosque to preserve the purity of the latter as a regular prayer space, which could be soiled by the presence of a dead body. This oratory dates back to the Almoravid period and also features embellishments such as a muqarnas cupola and a number of ornate archways in varying forms. Spoliated capitals from al-Andalus are also re-used here in the doorways leading from the prayer hall to the funerary annex and in the columns supporting the muqarnas cupola.
Behind the southern wall of the mosque and east of the mihrab axis is the historic library of the mosque and university. It is sometimes cited as the world's oldest library that remains open. The first purpose-built library structure was added to the mosque by the Marinid sultan Abu Inan Faris in 1349 CE, though it was located at the mosque's northeastern corner instead of to the south. The first structure still exists embedded near the women's section of the mosque, and consists of a square chamber measuring 5.4 meters per side. Its entrance is covered by a wooden screen from the Marinid period which features an inscription carved in cursive Arabic above the doorway recording Abu Inan's foundation of the library.
The current library building dates in part from a Saadian construction by Ahmad al-Mansur (late 16th century), who built a chamber called al-Ahmadiyya behind the qibla wall. Most of the building dates from a major 20th-century expansion commissioned by King Mohammed V that started in 1940. It included the current grand reading room, which measures 23 metres long and features an ornately-painted wooden ceiling, and also added an entrance outside the mosque which made it accessible to non-Muslims. This new library expansion was inaugurated in 1949. The library complex underwent another major restoration in recent years led by Aziza Chaouni and was set to reopen in 2016 or 2017.
UNESCO has previously described al-Qarawiyyin to be the "oldest university in the world" in the World Heritage Sites entry for Medina of Fez. UNESCO describes the University of Bologna (founded in 1088 and usually recognized as the oldest medieval European university) as the "oldest university of the Western world". Some historians and scholars also refer to al-Qarawiyyin as the world's oldest existing university. The claim is also published by the Guinness World Records, under its entry for "[o]ldest higher-learning institution, oldest university", where it describes al-Qarawiyyin as the "oldest existing, and continually operating educational institution in the world", while the University of Bologna is described as the "oldest one in Europe". Similarly, the Encyclopædia Britannica dates al-Qarawiyyin University's foundation to the mosque's foundation in 859 and generally considers that "universities" existed outside Europe before the advent of the European university model. Other sources also refer to the historical or pre-modern al-Qarawiyyin as a "university" or an "Islamic university".
Many scholars consider the term university to be applicable only to the educational institutions that initially took form in medieval Christian Europe, and argue that the first universities were located in Western Europe, with those of Paris and Bologna often cited as the earliest examples. The modern Western university model is thus widely argued to descend from this European tradition, even if other models of higher education existed in other parts of the world. Jacques Verger says that while the term university is occasionally applied by scholars to madrasas and other pre-modern higher learning institutions out of convenience, the European university marked a major disruption between earlier institutions of higher learning and was the earliest true modern university. Many scholars consider that the university was only adopted outside the West, including into the Islamic world, in the course of modernization programs or under European colonial regimes since the beginning of the 19th century.
Among opposing views, Yahya Pallavicini claims that the university model did not spread in Europe until the 12th century and that it was found throughout the Muslim world from the founding of al-Qarawiyyin in the 9th century until at least European colonialism. Some scholars, noting certain parallels between such madrasas and European medieval universities, have proposed that the latter may have been influenced by the madrasas of the Muslim world, in particular via Islamic Spain and the Emirate of Sicily. Other scholars have questioned this, citing the lack of evidence for an actual transmission from the Islamic world to Christian Europe and highlighting the differences in the structure, methodologies, procedures, curricula and legal status of the madrasa versus the European university.
Some scholars consider that al-Qarawiyyin operated essentially as an Islamic madrasa until after World War II. These scholars date al-Qarawiyyin's transformation into a university to its modern reorganization in 1963. In the wake of these reforms, al-Qarawiyyin was officially renamed "University of Al Quaraouiyine" two years later. Organization at the pre-modern al-Qarawiyyin differed from European universities and other Muslim institutions at al-Azhar (in Cairo) and al-Zaytouna (in Tunis) in that there was no defined scholastic year, registration was not imposed, study durations were not fixed, and there was no examination to ratify studies. Students were expected to attend courses for a minimum of five years and would receive an ijazah if they were proven to have reached a high level of expertise.
The earliest date of formal teaching at al-Qarawiyyin is also uncertain. The most relevant major historical texts like the Rawd al-Qirtas and the Zahrat al-As do not provide clear details on the history of teaching at the mosque. In the Rawd al-Qirtas, Ibn Abi Zar mentions the mosque but not its educational function. Al-Jazna'i, the 14th-century author of the Zahrat al-As, mentions that teaching had taken place there well before his time, but with no other details. Otherwise, the earliest mentions of halaqa for learning and teaching may not have been until the 10th or the 12th century. Moroccan historian Mohammed Al-Manouni believes that it was during the reign of the Almoravids (1040–1147) that the mosque acquired its function as a teaching institution. French historian Évariste Lévi-Provençal dates the beginning of the madrasa and teaching to the later Marinid period (1244–1465). Another Moroccan historian, Abdelhadi Tazi, indicated the earliest evidence of teaching at al-Qarawiyyin in 1121. Upon reviewing the evidence in Abdelhadi Tazi's work, Abdul Latif Tibawi states that:
A number of well-known philosophers, scholars, and politicians in the history of Morocco and the western Mediterranean have either studied or taught at the Qarawiyyin since its founding.