Fez or Fes (Arabic فـاس, French Fès) is the third largest city in Morocco, after Casablanca and Rabat, with a population of 940,000. It is one of the four so-called "imperial cities" (the others are Marrakesh, Meknes and Rabat).

History

The city was founded by Idris I in 789. In 810 the Kairouyine mosque, one of the oldest and largest in Africa, was built by Idris II. The city was populated by Muslims from elsewhere in North Africa and the Middle East, as well as many Jews, who had their own quarter in the city. Fez became the scientific and religious center of Morocco, where both Muslims and Christians from Europe came to study. Many Muslim refugees came to Fez after the reconquest of Spain in 1492. Fez became part of the Moroccan Empire in 1548, and in 1554 the Ottoman Turks briefly captured it.

Fez became the center of the Alaouite dynasty in 1649, and it was a major trading post of the Barbary Coast of North Africa. Until the 19th century it was the only source of Fez hats, before they began to be manufactured in France and Turkey; originally, the dye for the hats came from a berry that was grown outside the city. Fez was also the end of a north-south gold trading route from Timbuktu.

Fez was the capital of Morocco intermittently in the past, lastly until 1912, when most of Morocco came under French control and Rabat became the capital (which it remained when Morocco became independent in 1956).