On the far edge of the Maghrib, far from the centres of the caliphate in the East, arose a city that would become one of the most important metropolises that shaped the Islamic character of the Maghrib.
It is Fez, a city whose founding is tied to the Idrisid dynasty in the late second century AH / eighth century CE, and which in the centuries that followed became a centre of learning, jurisprudence, trade and industry, and at various times a political capital.
Yet Fez's importance does not lie in its having been the capital of Morocco alone. It was a meeting place: groups from Kairouan, al-Andalus, the East and the Maghrib converged there, trade routes joined with circles of learning, and the Qarawiyyin Mosque became one of the most prominent centres that carried Islamic sciences to wide areas of the Islamic West.
A city born of two banks
Fez's birth is linked to the name Idris I, who began founding the city in approximately 172 AH / 789 CE. His son Idris II then expanded it and made it the capital of his state.
The traditional account holds that Idris II founded the second town in approximately 192 AH / 807 CE on the opposite bank of the Wadi Fez, and that the two settlements developed until they became the historic core of Fez. Historical sources confirm that the old city indeed grew out of two large quarters separated by the river: the quarter of the Andalusians and the quarter of the Qarawiyyin.
Here one of Fez's early characteristics appears: it was not born from a single urban mass, but from population and cultural groupings that gradually interacted until they became one city.
The Idrisids and the birth of a capital of the Islamic Maghrib
With Idris II, Fez became the capital of the Idrisid state, and it changed from a new settlement into a political and economic centre.
Sources indicate that the Idrisids built mosques, markets, baths and caravanserais, and encouraged the settlement of residents, craftsmen and merchants. The Turkish Islamic Encyclopaedia notes that in the Idrisid period Fez became a political, religious and economic centre, and that scholars came to it from Kairouan and al-Andalus, helping make it one of the most important centres of learning in the Maghrib.
This population diversity had a profound effect. Kairouan did not reach Fez only as goods; a scholarly and juristic tradition arrived with them. Al-Andalus did not reach it merely as a geographical neighbour; those who came from there carried their language, literature, arts and urban experience.
al-Qarawiyyin: the mosque that became an institution of learning
In 245 AH / 859 CE, Fatima al-Fihriya began building the Qarawiyyin Mosque in the Qarawiyyin quarter.
Morocco's Ministry of Endowments and Islamic Affairs states that construction of the mosque began on the first of Ramadan 245 AH / 857 CE, and that its present square minaret is associated with a later phase, while archaeological sources explain that the mosque underwent major expansions in the Almoravid, Almohad and Marinid periods.
The importance of al-Qarawiyyin did not lie in the size of the building alone. Over time the mosque became a centre of circles of learning, where jurists, traditionists, linguists and reciters met, and to which students flocked from across the Maghrib, al-Andalus and Africa.
Fez thus gradually became a city in which the mosque left an impact beyond its religious function: the mosque became an institution of knowledge, and the city around it became a scholarly community.
The University of al-Qarawiyyin states that the mosque developed from a place of worship and preaching into a space for circles of learning and specialisation, and that madrasas, residences and libraries were linked to it over the centuries.

The Almoravids: when Fez entered a new phase
When the Almoravids took control of Fez in the fifth century AH / eleventh century CE, the city was no longer a limited local centre. It became part of a vast state extending from the Maghrib to al-Andalus.
Under Ali ibn Yusuf ibn Tashfin, the Qarawiyyin Mosque saw important expansions, and architectural and decorative elements were added that made it a prominent example of Moroccan architecture with Andalusian influence. Studies of Islamic art indicate that the Almoravids enlarged the prayer hall and added decorative elements, while later phases preserved the basic structure and developed it.
The Almohads: a city beyond the borders of the state
In the sixth century AH / twelfth century CE the Almohads entered Fez, and the city became part of an empire extending from the Maghrib to al-Andalus.
Its scholarly status did not disappear during the political transition; religious institutions continued to perform their role.
The architecture of al-Qarawiyyin itself reveals this accumulation: the inscriptions and architectural elements dating to the Idrisid, Almoravid, Almohad and Marinid periods show that each dynasty left a new layer above the earlier ones.
The Marinids: Fez's golden age
If the Idrisids made Fez a capital, and the Almoravids and Almohads expanded its scope, the Marinids gave the city one of its most prominent phases of prosperity.
In approximately 674 AH / 1276 CE the Marinid sultan Abu Yusuf Yaqub founded a new city west of old Fez, known as New Fez.
This city housed the royal palace, military centres, fortifications and residential areas, while Fez al-Bali remained a dense centre of mosques, markets, scholars and craftsmen. Thus Fez became composed of two functionally integrated cities.
Madrasas were built in this period as well. They were not merely beautiful buildings: they were educational institutions that received students, provided them with lodging, and were connected to the scholarly life of al-Qarawiyyin.
A study of Marinid Fez describes this era as a period in which the city reached its political and artistic peak, while UNESCO places the Marinid city among the most significant stages in the formation of its urban fabric.

Fez: a city of learning that crosses borders
One of the main reasons Fez's status endured is that its learning was never confined within its walls.
The city was associated with the Maliki school of law, with the sciences of hadith, language and the readings of the Qur'an, and it became a stopping point for scholars arriving from al-Andalus, the Maghrib and Africa.
This illustrates Fez's greatest function: it was not only a place that received learning, but a station in the network of scholars that linked parts of the Islamic world with one another.
A city shaped by trade as well
Fez's prosperity was not only scholarly. Its location made it part of the trade routes between North Africa and al-Andalus, and between the Maghrib and the caravan routes of the Sahara leading to sub-Saharan Africa.
Its crafts flourished in leather, textiles, metalwork and pottery, and markets and caravanserais became essential parts of the city's economy. Crafts were distributed across specialised quarters and markets, a feature of the traditional Islamic city.
Fez was thus associated with three elements that built its strength: learning, craft and trade.
Fez: a city that endured after the capital moved
The capitals of Morocco shifted through history among Fez, Marrakesh, Meknes and then Rabat, but Fez retained its symbolic and scholarly standing.
Even after the modern political capital moved to Rabat in 1330 AH / 1912 CE, the old city preserved its urban fabric, religious institutions, crafts and markets.
For this reason UNESCO inscribed the old city of Fez on the World Heritage List in 1400 AH / 1981 CE, considering it among the best-preserved historic Arab-Islamic cities, especially in terms of the continuity of its urban, craft and everyday functions.
Here lies Fez's significance on the map of Islamic metropolises: many cities lived a golden age and then became monuments, whereas in Fez a large part of the old city has remained alive, and its mosques, madrasas, markets and crafts are still tied to daily life.




