page_title: Madrid
section_title: Middle Ages
hierarchical_section_title: Madrid / History / Middle Ages
caption_attribution_description: English: Ruins of Muslim wall of Madrid (Spain). Español: Vestigios de la muralla musulmana de Madrid (España).
context_page_description: Madrid is the capital and most populous city of Spain. The city has almost 3.3 million inhabitants and a metropolitan area population of approximately 6.5 million. It is the second-largest city in the European Union, surpassed only by Berlin, and its monocentric metropolitan area is the second-largest in the EU, surpassed only by Paris. The municipality covers 604.3 km².
  Madrid lies on the River Manzanares in the centre of both the country and the Community of Madrid region, of which it is also the capital. As the capital city of Spain, seat of government, residence of the Spanish monarch, Madrid is also the political, economic and cultural centre of the country. The mayor is José Luis Martínez-Almeida from the People's Party.
  The Madrid urban agglomeration has the third-largest GDP in the European Union and its influence in politics, education, entertainment, environment, media, fashion, science, culture, and the arts all contribute to its status as one of the world's major global cities. Madrid is home to two world-famous football clubs, Real Madrid and Atlético Madrid.
context_section_description: Although the site of modern-day Madrid has been occupied since prehistoric times, and there are archaeological remains of Carpetani settlement, Roman villas, a Visigoth basilica near the church of Santa María de la Almudena and three Visigoth necropoleis near Casa de Campo, Tetúan and Vicálvaro, the first historical document about the existence of an established settlement in Madrid dates from the Muslim age. At the second half of the 9th century, Emir Muhammad I of Córdoba built a fortress on a headland near the river Manzanares, as one of the many fortresses he ordered to be built on the border between Al-Andalus and the kingdoms of León and Castile, with the objective of protecting Toledo from the Christian invasions and also as a starting point for Muslim offensives. After the disintegration of the Caliphate of Córdoba, Madrid was integrated in the Taifa of Toledo.
  With the surrender of Toledo to Alfonso VI of León and Castile, the city was conquered by Christians in 1085, and it was integrated into the kingdom of Castile as a property of the Crown. The knight Ivan de Vargas, who distinguished himself in the conquest of Madrid, was the founder of the House of Vargas, from whom the common Spanish surname "Vargas" is derived. Following the conquest, Christians replaced Muslims in the occupation of the centre of the city, while Muslims and Jews settled in the suburbs. The city was confirmed as villa de realengo (linked to the Crown) in 1123, during the reign of Alfonso VII of León and Castile. The 1123 Charter of Otorgamiento established the first explicit limits between Madrid and Segovia, namely the Puerto de El Berrueco and the Puerto de Lozoya. Since 1188, Madrid won the right to be a city with representation in the courts of Castile. In 1202, Alfonso VIII of Castile gave Madrid its first charter to regulate the municipal council, which was expanded in 1222 by Ferdinand III of Castile. The government system of the town was changed to a regimiento of 12 regidores by Alfonso XI of Castile on 6 January 1346.
  Since the mid-13th century and up to the late 14th century, the concejo of Madrid vied for the control of the Real de Manzanares territory against the concejo of Segovia, a powerful town north of the Sierra de Guadarrama mountain range, characterised by its repopulating prowess and its husbandry-based economy, contrasted by the agricultural and less competent in repopulation town of Madrid. After the decline of Sepúlveda, another concejo north of the mountain range, Segovia had become a major actor south of the Guadarrama mountains, expanding across the Lozoya and Manzanares rivers to the north of Madrid and along the Guadarrama river course to its west.
  In 1309, the Courts of Castile convened at Madrid for the first time under Ferdinand IV of Castile, and later in 1329, 1339, 1391, 1393, 1419 and twice in 1435. Since the unification of the kingdoms of Spain under a common Crown, the Courts were convened in Madrid more often.
caption: A section of the Muslim Walls of Madrid. For a list of all the walls, see: Walls of Madrid.
exif: {"Image ImageDescription": "OLYMPUS DIGITAL CAMERA", "Image Make": "OLYMPUS IMAGING CORP.", "Image Model": "FE170,X760", "Image Software": "1.0", "Image DateTime": "2008:01:19 13:37:12", "Image YCbCrPositioning": "Co-sited", "Image ExifOffset": "776", "Image PrintIM": "[80, 114, 105, 110, 116, 73, 77, 0, 48, 51, 48, 48, 0, 0, 37, 0, 1, 0, 20, 0, ... ]", "EXIF ExposureTime": "1/1000", "EXIF FNumber": "23/5", "EXIF ExposureProgram": "Program Normal", "EXIF ISOSpeedRatings": "64", "EXIF ExifVersion": "0221", "EXIF DateTimeOriginal": "2008:01:19 13:37:12", "EXIF DateTimeDigitized": "2008:01:19 13:37:12", "EXIF ComponentsConfiguration": "YCbCr", "EXIF ExposureBiasValue": "0", "EXIF MaxApertureValue": "163/50", "EXIF MeteringMode": "CenterWeightedAverage", "EXIF LightSource": "Unknown", "EXIF Flash": "Flash did not fire, auto mode", "EXIF FocalLength": "63/10", "EXIF FlashPixVersion": "0100", "EXIF ColorSpace": "sRGB", "EXIF ExifImageWidth": "2816", "EXIF ExifImageLength": "2112", "EXIF FileSource": "Digital Camera", "EXIF CustomRendered": "Normal", "EXIF ExposureMode": "Auto Exposure", "EXIF WhiteBalance": "Auto", "EXIF DigitalZoomRatio": "1", "EXIF SceneCaptureType": "Standard", "EXIF GainControl": "None", "EXIF Contrast": "Normal", "EXIF Saturation": "Normal", "EXIF Sharpness": "Normal"}