In the narrow streets of Fez's Old City, Morocco's first capital, centuries-old places of learning are being revived to promote moderation in Islam, as their founders originally intended.
Studying at the 14th century Bou Inania madrassa (religious school), inside the UNESCO-listed walled city, offers a life "in the embrace of a venerable academic history", according to student Moaz Soueif.
The Bou Inania madrassa is one of six such institutions to be renovated since 2017, under a program funded by Morocco's government to preserve the city's heritage and promote tourism.
Soueif, 25, shares the madrassa's upper floor with around 40 students of the Qarawiyyin University, which was a world-leading spiritual and educational hub centuries before the European renaissance.
Adorned throughout with intricate inscriptions and mosaics, students are not Bou Inania's only visitors. Tourists also flock to see the elegant open-air courtyard, graced by a central fountain and walls of carefully maintained tilework.
The madrassa sits just inside Bab Boujelloud, one of the Old City's main entrances and a key landmark for tourists.
PAY ATTENTION: Share your outstanding story with our editors! Please reach us through firstname.lastname@example.org!
The nearby Cherratine and Attarine madrassas were also recently renovated for the benefit of tourists, who "usually say their time here feels spiritual and the Old City is really genuine", according to guide Sabah Alawi.
Today, Fez serves as a monument to a highpoint of Islamic civilisation, the 13th and 14th centuries when Muslim rulers governed from Morocco to western China.
That period also represents a golden age in the city's history, which had just been reinstated as Morocco's capital after three centuries of being overshadowed by Marrakesh further south.
Down a steep alley from Bou Inania lined with stalls selling traditional wares and local food, stands the Qarawiyyin mosque, built when the city was founded in the ninth century.
It later became the heart of the university of the same name -- one of the oldest in the world.
Fez University history professor El-Haj Moussa Aouni said the city thrived in the 13th-14th centuries along with other centres across the Maghreb region -- from Marrakech to Oran in Algeria and Kairouan in Tunisia.
The madrassas of Fez are "add-ons to the main university, which were used for teaching sciences such as maths, medicine, mechanics and music, as well as Islamic studies and literature", he said.
The Qarawiyyin mosque has a large, roofless courtyard surrounded by pillars separating it from the covered sections, which are set aside for prayer and study.
The site is off-limits to tourists -- although some take advantage of the doors being opened shortly before prayers to snap photos in the courtyard.
At the time of its establishment the university was one of the best in the world and hosted noted scholars such as Tunisian Ibn Khaldoun, seen as the founding father of sociology.
Another prominent figure believed to have studied there was Gerbert of Aurillac, a polymath who introduced Arabic numerals to Europe, is credited with inventing the mechanical clock, and later became Pope Sylvester II.
As well as preserving the city's architectural treasures, the renovation work is part of Morocco's wider efforts to promote moderation in Islam.
Model of tolerance
The scholars have left their mark on the city -- such as at the Qarawiyyin library, home to some 4,000 manuscripts including an original donated by Ibn Khaldoun himself.
"It's among the oldest libraries in the Islamic world," said its rector Abdulfattah Boukachouf.
The 14th-century institution sits on a courtyard filled with the ringing of hammers of brass and silver workers. But in the reading room, last extended by Sultan Mohammed V -- grandfather of the current King Mohammed VI -- silence reigns.
In a corner, a team of women expertly restore delicate manuscripts.
Qarawiyyin University has started a new programme for post-graduate students who have excelled in writing and memorising the Koran.
Students cover "various Islamic studies, comparative religion, French, English and Hebrew, allowing them to understand other cultures", said Soueif, from the northern town of Ksar El-Kebir.
"We should be a role model for tolerant Islam, at the same level of the great scholars who passed through here before us," he said.