Although the area has been inhabited since ancient times, the foundation of the city now known as Madrid owes its origins to a small Roman settlement built on the banks of the Manzanares River called Matrice. It seems that by the late Visigothic period (7th century) this settlement was largely abandoned and only a small village remained. It was only in the ninth century, during the Umayyad period in al-Andalus, that Madrid became an important town in central Iberia (although still not as significant as Toledo).
During the late ninth century, the Umayyad emir Muhammad I (r. 852–886)—seeking to fortify the strategically-important region known as the Central Frontier (al-thaghr al-awsat) against the northern Christian kingdoms—ordered the construction of a fortified town along the Manzanares River. It was named Majrīṭ. Although the etymology of the name remains contested, it is possible that it derives from the Arabic word “mayra,” a reference to water as sustenance and a giver of life and the Ibero-Roman suffix “-it” meaning place; other etymologies suggest that it derives from a medieval Andalusi Arabic word for “water-wheel.” Another theory is that it is simply an Arabization of the earlier Visigothic word for the Roman settlement of Matrice. Either way, it is from “Matrīt” (the local Mozarabic pronunciation of the Arabic “Majrīṭ”) that the modern Spanish name of the city, Madrid, is derived. During the Andalusī era (ca. 9th-11th centuries), this frontier town became an important military, political and cultural center. Perhaps the most eminent of the scholars that it produced during the early Middle Ages was Abū al-Qāsim Maslamah b. Aḥmad al-Majrīṭī (d. 1007), a prominent astrologer, astronomer, chemist and mathematician. It is to this scholar that the two most important Andalus works of Occult Sciences and astral magic—the Rutbat al-Ḥakīm and the Ghāyat al-Ḥakīm (known as the Picatrix in Latin)—are attributed.
The fortress-town of Andalusī Majrīṭ, following the layout of most Ibero-Muslim urban centers in the Middle Ages, consisted of two parts: the Alcazaba (or governor’s fortress) overlooking the town and the town proper (al-madīnah) which consisted of the residential quarter, market-place and the grand mosque. The entire settlement was enclosed by a fortified wall, but small residential settlements (an area known as al-rabaḍ or suburbs) sprung up beyond it and across the river. The residential area of Majrīṭ was known by the inhabitants as al-Mudayna (or “little city”), from which the modern Almudena is derived. For more on medieval Madrid, see: http://sdelbiombo.blogia.com/2008/072201-el-origen-de-madrid-el-mayrit-islamico.php. The following are some artistic reconstructions of ninth and tenth century Majrīṭ along with some maps showing the specific area covered by the town in the Middle Ages.
(The original military settlement, ca. 9th century)
(Majrīṭ as it may have appeared at the time of the Christian conquest in the late 11th century)
As one will notice, the center of medieval Majrīṭ corresponds with the current location of the Royal Palace and the Almudena Cathedral (and their immediate surroundings) in Madrid, an area that formed the nucleus of the medieval Christian city of Madrid. Indeed the Almudena Cathedral was originally Majrīṭ’s grand mosque, which Alfonso VI ordered reconsecrated as a church following his conquest of the city in 1085. The modern city of Madrid, with its center around the Plaza Mayor, was a product of the early modern period and particularly the Hapsburg dynasty in the 16th century.
(Map showing the medieval Islamic and Christian boundaries of Madrid)
(A painting of the walls of Madrid as they would have appeared in the Middle Ages)
(The Royal Palace and the Almudena Cathedral, roughly corresponding to the medieval Andalusi Muslim town of Majrīṭ)
The only part of medieval Majrīṭ that has survived into the present are the remnants of one part of the ancient walls enclosing the city. They can be observed in the Park of Muhammad I located behind the Almudena Cathedral.
Algora Weber, Maria Dolores et al. (2011). De Maŷrit a Madrid: Madrid y los árabes, del siglo IX al siglo XXI. Casa Árabe e Instituto Internacional de Estudios Árabes y del Mundo Musulmán
Andrew Mediero, E. (2000). Excavaciones arqueológicas en la Plaza de la Armería de Madrid. Informes de las excavaciones arqueológicas, Madrid, Dirección General de Bellas Artes y Bienes Culturales, Ministerio de Educación y Cultura.
_____________. (2007). “El Madrid medieval”, Caesaraugusta, 78: 687-698.
Caballero, L. et al. (1983). “Las murallas de Madrid. Excavaciones y estudios arqueológicos (1972-1982)”, Estudios de Prehistoria y Arqueología Madrileña, 2: 9-182.
Fernandez Ugalde, A., Marin Perellon, F. J., Mena Munoz, P. y Serrano Herrero, E. (1998). Las murallas de Madrid. Arqueología medieval urbana, Comunidad de Madrid, Dirección General de Patrimonio Cultural.
Garcia Escalona, E. (1990). “Madrid medieval actual”, in De Miguel Rodriguez, J. C., El Madrid medieval. Sus tierras y sus hombres, Asociacion Cultural Al-Mudayna, pp. 239–251.
Montero Vallejo, M. (2007), “Madrid musulmán”, in Fernandez Garcia, A., Historia de Madrid, Instituto de Estudios Madrileños, pp. 88–92.
Valdes, Fernando ed. (1992). Maŷrīt: estudios de arqueología medieval madrileña.