The site of Madrid has been occupied since prehistoric times, as has been shown by numerous objects found during different excavations along the banks of the River Manzanares. Many of these objects (axes and small Palaeolithic objects, remains of animals that prove the existence of large mammals, Neolithic ceramics, etc.) can be seen at the National Archaeological Museum. Madrid's population was initially Iberian and later Roman, and is possibly the Mantua found in certain ancient references and the Roman Miacum from the "Antonine itinerary", although some historians dispute this.
It is now commonly believed that the original name of the settlement here was Matrice, a pre-Muslim word, which refers to the waters of the area and particularly to the stream running down the Calle de Segovia.
However, Madrid as such does not achieve a mention in chronicles until the late tenth century, at which time there was already a fort or castle where the Royal Palace stands today. This fort was occupied by the Moors, who having named the River Manzanares al-Magrit ("source of water"), referred to the area as Mayrit (from which Magerit, then Madrid) and around which the borough of Madrid developed in the following centuries. The old arab walls surrounding this settlement can still be seen today (more info here).
Between several different warriors, the Moors kept rule until Madrid was finally conquered in 1085 by Alfonso VI in his advance towards Toledo. This king ordered the main mosque within the fort's walls to be "purified" and consecrated as a Catholic church under the guidance of the Virgin of the Almudena, the name deriving from a religious icon found near the "almudín" or wheat deposit. La Virgen de la Almudena later became Madrid's female patron saint, whose saint's day is celebrated on 9th November and who gives her name to Madrid's cathedral.
In the year 1329, King Fernando V assembled The Court of Madrid for the first time.
A little later, due to the Reconquista, Moors and Jews formed a concentrated population in the area that still today carries the name of Morería, but in 1494 the "unbelievers" were expelled and the mosque and other indicative buildings disappeared.
Later, Madrid was taken by the followers of Enrique of Tastamara and ceded by Juan I to King Leon V of Armenia who was then dethroned by the Sultan of Babilonia. Having been destroyed by fire during the reign of Enrique II, the city was rebuilt by his grandson Enrique III, who reincorporated Madrid under the Crown of Castille and who also founded El Pardo, situated just outside the city.
Enrique VI gave Madrid the title of "Very Noble and Loyal" and celebrated here his magnificent wedding with Doña Juana of Portugal. The death of the king caused the formation of two distinct bands within the Castille kingdom - the two sides disputing the succession of the throne. Isabel and her supporters overcame Doña Juana's followers and the victorious "Catholic Kings" (Isabel and her husband Fernando) solemnly entered the city to reside in a mansion in the Plaza de la Paja owned by Don Pedro Lasso de la Vega.
During the war of Communities, the Borough of Madrid took sides with the "Comuneros", although this did not prevent Emperor Carlos V bestowing on the city the title of "Crowned and Imperial". As remnants of these times we can cite the Church of San Jerónimo, the Church of del Paso and the Tower of Lujanes, this last in the Plaza de la Villa, opposite the Ayuntamiento or City Hall where Francis I of France was held prisoner after his defeat at Pravia in Italy.
Carlos V was certainly enamoured with Madrid, amongst other things because he managed to cure himself here of tertian fever. However, it was his son, Felipe II who moved the Imperial Court to Madrid in 1561, although without making any official declaration. The population of the borough at this time was around 25,000. From this time Madrid was now the kingdom's capital, apart from the brief years between 1601 and 1606 when Felipe III installed his court in Valladolid.
Madrid enjoyed significant changes during the 18th century, when city gates, bridges and new buildings gave it a new appearance. The Royal Palace (also called the Eastern Palace - Palacio de Oriente, standing next to the large Plaza de Oriente square) was constructed on the site of the ruins of the Alcazar or old Moorish Castle which had been destroyed by fire in 1734. After 1738 Juan B. Sachetti directed the construction work on the Palace, helped out to some extent by Ventura Rodríguez and developing on original plans made by Juavera. The work was practically completed by 1760.
The reign of Carlos III (1759 - 1788) helped to greatly improve the appearance of the city. The work on the Royal Palace was totally completed (as we know it today), as was the construction of the city gates of Puerta de Toledo, Puerta de Segovia (no longer standing) and Puerta de Alcalá, together with the Royal Theatre, the building that now houses the Ministry of Finance (Hacienda), the Natural Science Museum, the Botanical Gardens and the temple of San Francisco El Grande, amongst others. Also, the Retiro Park was significantly improved and several new buildings built: Casa de Cisneros, the General Hospital, the College of San Carlos, the Royal Mint, Casa de los Geranios and the fountains of Cibeles, Neptune and Apollo.
The reign of Carlos IV gave Madrid the Buenavista Palace (today the Ministry of Armed Forces) and other notable mansions such as that of the Dukes of Liria in Princesa Street and that of the Count of Altamira in Calle de la Flor.
On the 2nd of May 1808 a popular revolt started in the Puerta del Sol, initiating the War of Independence. There are numerous place names in Madrid dedicated to these patriotic disturbances, the most significant being of course the Plaza Dos de Mayo in Malasaña. Once General Castaños had repelled the invaders in Bailén, he entered Madrid on 23rd August 1808. However, there were further battles when Emperor Napoleon presented himself in Chamartín and also in December of the same year when José Bonaparte entered Spain, only to be expelled three years later under pressure from the Anglo-Hispanic army led by Wellington. The last of the French left Madrid on the 27th May 1813 and the following year King Fernando VII entered the city.
In 1835 the famous University of Alcalá de Henares was transferred to Madrid, where the Faculty of Science was added, becoming the Universidad Complutense de Madrid.
The city continued to be improved during the reign of Isabel II with old houses in the Puerta del Sol being pulled down and the Congreso de los Diputados or Parliament, Royal and Zarzuela Theatres and the Canal de Isabel II (Madrid's water lifeline) being built. Also, in 1857, Madrid's gas lighting system was inaugurated.
Since then Madrid's urban progress has accelerated to reach, today, the level of one of Europe's most beautiful capital cities - pleasing both for its intense animated spirit and its suitable mix of modern and classical appearance.
*Information Taken From GoMadrid.com