some of the institutions and building types that became characteristic of the historic Muslim world. For example, bimaristans, historical equivalents of hospitals, first originated further east in Iraq, with the first one being built by Harun al-Rashid (between 786 and 809). They spread westward and first appeared in Morocco around the late 12th century when the Almohads founded a maristan in Marrakesh. Madrasas, another important institution, first originated in Iran in the early 11th century under Nizam al-Mulk, and were progressively adopted further west. The first madrasa in Morocco (Madrasat as-Saffarin) was built in Fes by the Marinids in 1271, and madrasas further proliferated in the 14th century. In terms of decorative motifs, muqarnas, a notable feature of Moroccan architecture introduced in the Almoravid period in the 12th century, also originated at first in Iran before spreading to the west. Al-Andalus (Muslim Spain and Portugal) The culture of Muslim-controlled Al-Andalus, which existed across much of the Iberian Peninsula to the north between 711 and 1492, also had close influence on Moroccan history and architecture in a number of ways – and was in turn influenced by Moroccan cultural and political movements. Jonathan Bloom, in his overview of western Islamic architecture, remarks that he "treats the architecture of North Africa and the Iberian Peninsula together because the Straits of Gibraltar were less of a barrier and more of a bridge." In addition to the geographic proximity of the two regions, there were many waves of immigration from Al-Andalus to Morocco of both Muslims and Jews. One of the earliest waves were the Arab exiles from Cordoba who came to Fes after a failed rebellion in the early 9th century. This population transfer culminated in the waves of refugees that came after the fall of Granada in 1492, including many former elites and members of the Andalusi educated classes. These immigrants played important roles in Moroccan society. Among other examples, it was the early Arab exiles from Cordoba who gave the Andalusiyyin quarter of Fes its name and it was Andalusi refugees in the 16th century who rebuilt and expanded the northern city of Tétouan. The period of the Umayyad Emirate and Caliphate in Cordoba, which marked the peak of Muslim power in Al-Andalus, was an especially crucial era which saw the construction of some of the region's most important early Islamic monuments. The Great Mosque of Cordoba is frequently cited by