# History of Mexico City

The history of Mexico City stretches back to its founding ca. 1325 C.E as the Mexica city-state of Tenochtitlan, which evolved into the senior partner of the Aztec Triple Alliance that dominated central Mexico immediately prior to the Spanish conquest of 1519–1521. At its height, Tenochtitlan had enormous temples and palaces, a huge ceremonial center, and residences of political, religious, military, and merchants. Its population was estimated at least 100,000 and perhaps as high as 200,000 in 1519 when the Spaniards first saw it. During the final stage of the Spanish conquest of the Aztec Empire, Spanish forces and their indigenous allies besieged and razed Tenochtitlan. Because it was strategically and politically important, invader Hernán Cortés founded the Spanish colonial capital of Mexico City on its ruins, becoming the center of Spanish colonial power. Following Mexican independence from Spain in 1821, Mexico City became the capital of the sovereign nation, remaining its largest and most important city to the present day.
Beginning in 1521, the Aztec ceremonial and political center was rebuilt as the city's main square, the Plaza Mayor, usually called the Zócalo. Some of the oldest structures in Mexico City date from the early conquest era. Many colonial-era buildings remain standing and have been re-purposed as government buildings and museums. As the seats of the Viceroyalty of New Spain and the Archbishopric of New Spain, Mexico City was the center not only of political and religious institutions but also of Mexico's economic activity and the residence of Spanish colonial elites (1521–1821). Great merchant houses linked to Spain were located here, and the economic elites whose properties were often elsewhere in New Spain also lived in the capital. The concentration of mansions and palaces in what is now the Mexico City historic center led it to be nicknamed the "City of Palaces", a sobriquet often attributed, perhaps erroneously, to great savant Alexander von Humboldt. It was also a major educational center: the University of Mexico was founded in 1553 as part of the complex of the Plaza Mayor but is now located in the south of the capital. Many religious institutions for the education of the sons of Spanish elites were also based in the capital. Mexico City had the colony's largest concentration of those of Spanish heritage (both Iberian-born peninsulares and American-born criollos), as well as the largest concentration of mixed race casta population in the colony. Many indigenous people also lived in the capital, outside the central core, concentrated in their own section and governed by an indigenous town council. Post-independence, U.S. forces captured Mexico City during the Mexican–American War, and the city saw violence during the Reform War and the French Intervention as well as the Mexican Revolution. At the beginning of the 20th century, the city's population stood at about 500,000. The city's history in the 20th and 21st centuries has been marked by explosive population growth and its accompanying problems. The city center deteriorated. The government has had problems keeping up with basic services, but the building of the Mexico City Metro has alleviated some major transportation problems. Smog became a serious problem as the shanty towns evolved, formed by the poor of the country migrating to the city. The 1985 Mexico City earthquake caused significant damage to the center of the city. In the 2000s, businessman and philanthropist Carlos Slim created a foundation to revitalize the historic center as well as sites near the Basilica of the Virgin of Guadalupe. In 2016, the Mexican government initiated the process of greater autonomy from the federal government, creating the Ciudad de México or CDMX.

## The Aztec city-state of Tenochtitlan
### Founding

The Aztecs were one of the last of the Nahuatl-speaking peoples who migrated to this part of the Valley of Mexico after the fall of the Toltec Empire. Existing inhabitants resisted their presence, but the Aztecs established a city on a small island on the western side of Lake Texcoco. The Aztecs themselves had a story about how their city was founded after their principal god, Huitzilopochtli, led them to the island. According to the story, the god indicated their new home with a sign, an eagle perched on a nopal cactus with a snake in its beak. This image appears in Codex Mendoza, one early post-conquest manuscript of many Aztec codices or pictorial texts, and since Mexico's independence from Spain in 1821, the image is in the center of the Mexican flag. Between 1325 and 1521, Tenochtitlan grew in size and strength, eventually dominating the other city-states or altepetl around Lake Texcoco and in the Valley of Mexico. When the Spaniards arrived, the Aztec Empire reached much of Mesoamerica, touching both the Gulf of Mexico to the east and the Pacific Ocean to the west.
Two narratives about the founding of the Aztec city of Tenochtitlan, which would become modern Mexico City, overlap: the archeological and historic record, and the mythological and historical recounting from the Mexica themselves. The central highlands of what is now Mexico were inhabited for many centuries before the founding of the city. To the northeast are the ruins of Teotihuacan, whose empire and civilization mysteriously disappeared around 750 A.D.. After that, the Toltecs ruled the area in and around the Valley of Mexico until about 1200 AD. After the fall of the Toltec capital of Tollan, large migrations of people moved into the Valley of Mexico, bringing with them the concept of city-state known in Nahuatl as altepetl. This led to the founding of a number of semi-autonomous urban centers around Lake Texcoco each claiming legitimacy as descendants of the Toltecs. By the early 16th century, at least a dozen of these city-states had reached 10,000 in population with Tenochtitlan by far the largest at 150,000 and perhaps as high as 200,000.
The Mexica who founded Tenochtitlan were part of the last wave of migration of Nahuatl-speaking peoples into the valley. Their presence was resisted; however, taking advantage of the nearly constant conflict among the city-states along the lake shores, the Mexica of Tenochtitlan and their allies since 1430 of Texcoco and Tlacopan conquered the Valley of Mexico, exacting tribute from the same powers that resisted their migration in the first place.
The Mexica story is that they came from a place called Aztlán, described as an island in the middle of a lake. Their god Huitzilopochtli told them to go and look for a promised land. They first arrived around the territory known as Culiacán by 960 AD, but then left and returned to Aztlan. Wandering from Aztlan again around the year "1 Tecpatl" or 1064–65 according to the codices Chimalpahin, Aubin and the Anales de Tlalteloco, they soon arrived at Pátzcuaro. They thought that was the land Huitzilopochtli had promised them, but the god told them to continue. They went east and arrived at Chapultepec, on the edge of what was then Lake Texcoco. The god told them that their promised land was close but that they would have to fight for it. Their first opponent was a chief named Cópil, son of a witch named Malinalxochitl and Huitzilopochtli's sister. The Mexica surrounded Cópil's forces, captured and sacrificed the chief's heart to Huitzilopochtli.
However, the lords of Azcapotzalco, Tlacopan, Coyoacán and Culhuacan still opposed their arrival. At first they tried diplomacy to convince the Mexica to leave. The Mexica fought these lords and lost, retreating to a place called Acocolco and hiding in the marshes, becoming subjects of a people named the Colhuas. Two years later, the Colhuas asked the Mexicas to fight with them against Xochimilco. While the Mexica impressed the Colhuas with their battle skills, the latter expelled the former when the Mexica sacrificed the hearts of their captives to Huitzilopochtli. They went to Tizapan. After that, they wandered the rim of Lake Texcoco. The migration lasted around 260 years; from 1064 to 1065 to 1325.
The god indicated that they were getting closer when they arrived at Nexticpan, where San Antonio Abad Hospital is, and later at Mixiuhcan, now the colonia of Magdalena Mixiuhcan. They wandered another 36 years knowing that they were extremely close. Then they sent two priests named Axolóhua and Cuauhcoatl to look for the sign their god promised them. The two found an islet near the western shore of Lake Texcoco surrounded by green water. In the middle of the islet was a nopal, and an eagle perched upon it with its wings spread and its face looking toward the sun. When the eagle left, Axolóhua submerged himself into the waters around the island and Cuaucoatl went back to report what he saw. The people were confused because what the two priests had seen was only part of the sign they were told to expect. Twenty-four hours later Axolóhua returned. While underwater, he saw the god Tlaloc who told him that they did indeed find the place and that they were welcome. They moved to the islet and began to construct their city. Later versions of the story have a snake in the eagle's mouth. The Mexica called their city Tenochtitlan meaning "place of the nopal," referring to the myth of its discovery. Carlos de Sigüenza y Góngora gives the day 18 July 1327, but at least three other codices (Azcatitlan, Mexicanus and Mendoza) placed the time of its founding in the year 1325, and los Anales de Tlatelolco adds the day-sign "1 Zipaktli," correlated to the beginning of summer solstice on 20 June.

### Tenochtitlan at its height

Thirteen years after the founding of Tenochtitlan, the population of the islet had grown and there was internal strife. A portion of the population left and went to the nearby island of Tlatelolco, establishing a monarchy there, with their first ruler being Acamapitzin. Shortly thereafter, the people of Tenochtitlan had their own monarchy. The two cities became rivals. Eventually, Tenochtitlan conquered Tlatelolco eliminating its rulers and incorporated the city into Tenochtitlan and was named Mexico which some natives didn't like.
At its height, just before the Spanish arrived, Tenochtitlan was the center of the vast Aztec Empire, stretching from the Atlantic to Pacific coasts and south towards the Yucatán Peninsula and Oaxaca. With a vast income of tribute, Tenochtitlan grew to become one of the largest and richest urban areas in the world at that time. The city had services and infrastructure that was unheard of in the rest of the world: potable water brought in by aqueducts, drainage systems and wide, paved streets. Their markets boasted of products from nearly every part of Mesoamerica.
Tenochtitlan roughly correlates with the historic center of modern Mexico City. During the pre-Hispanic era, the city developed in a planned fashion, with streets and canals aligned with the cardinal directions, leading to orderly square blocks. The island that the city was founded on was divided into four calpullis or neighborhoods that were divided by the main north–south roads leading to Tepeyac and Iztapalapa respectively and the west–east road that lead to Tacuba and to a dike into the lake, respectively. The calpullis were named Cuepopan, Atzacualco, Moyotla and Zoquipan, which had subdivisions and a "tecpan" or district council for each one. The intersection of these roads was the center of the city and of the Aztec world. Here were the main temple, the palaces of the tlatoani or emperors, palaces of nobles such as the "House of the Demons" and the "House of the Flowers". Also located here were the two most renowned Aztec schools: the Telpuchcalli for secular studies and the Calmecac for priestly training.

## Spanish conquest and reconstruction of city
### Conquest of Tenochtitlan

After landing near the modern-day city of Veracruz, Hernán Cortés heard about the great city and also learned of long-standing rivalries and grievances against it. Although Cortés came to Mexico with a very small contingent of Spaniards, he was able to persuade many of the other native peoples to help him destroy Tenochtitlan.
For a time, these allied peoples made use of the arrival of the European in the hopes of creating a world freed of Aztec domination. Spanish objective, however, was that they themselves would benefit from the destruction of Tenochtitlan, making the native peoples not free, but rather more subservient to the Spaniards than they were to the Aztecs.
Moctezuma, then-chief of the Aztecs, had been receiving accounts of the Europeans' arrival since their ships (reported as towers or small mountains on the eastern sea) arrived in the Yucatán then Veracruz. First-hand accounts from Spaniards indicate that the Aztec were under some impression that Cortés was the god Quetzalcoatl. According to these reports, the direction of the ships' arrival and because of the Spaniards light skin, long beards and short hair fit a prophecy about this god's return. This motivated Moctezuma to send gifts to the Spaniards when they arrived in Veracruz. This has now been heavily criticised by historians, who believe that the Spaniards THOUGHT the Aztecs thought they were Gods, but there is little evidence from Mexica sources that this was the case, instead, Moctezuma was probably following known rules of statecraft established and sent gifts to demonstrate they did not plan on immediately attacking the newcomers.
Cortés first saw Tenochtitlan on 8 November 1519. Upon viewing it for the first time, Cortes and his men were "stunned by its beauty and size...." The Spaniards marched along the causeway leading into the city from Iztapalapa. The towers, temples and canoes filled with crowds who gathered to look at the strange men and their horses. Moctezuma came out from the center of Tenochtitlan onto the causeway to greet them. The two processions met at the entrance to the city. Moctezuma was in a litter draped with fine cotton mantles and borne on the shoulders of a number of lords. He emerged from the litter and the two leaders exchanged gifts. The Aztecs led the Spaniards into the heart of the city where Moctezuma gave them with more gifts and then quartered them in lavish apartments. However, Aztec accounts of the first meeting indicate that Moctezuma was too deferent and generous to the newcomers. An Aztec account relates how the people of Tenochtitlan felt: "as if everyone had eaten stupefying mushrooms..., as if they had seen something astonishing. Terror dominated everyone, as if all the world were being disembowelled.... People fell into a fearful slumber...."
However, the camaraderie between the two leaders did not last long. While the Spaniards marveled at the city's artifacts and strange foods, they were horrified by the religious rites involving human sacrifice and, being vastly outnumbered, Cortes worried greatly that Moctezuma was plotting to destroy him. So on 16 November, Cortés detained Moctezuma, placing him under house arrest. In this way, Cortés hoped to rule through the emperor. However, Moctezuma's power was dwindling in the eyes of his people. The Aztecs grew ever more resentful of the Spaniards' attacks on their religion and their relentless demands for gold. Resistance broke out on one of the lakeside settlements, which Cortés tried to quell by having a formal ceremony where the emperor swore allegiance to the Spanish king. He also tried to have the Mexica idols in the main temple replaced by Christian ones or at least put them side by side. To add to Cortés' troubles, the Spanish governor of Cuba sent an arrest party for Cortés, as his orders were not to conquer but simply to trade. This forced Cortés to leave Tenochtitlan in the hands of Pedro de Alvarado as he went to Veracruz to confront this party.
While Cortés was gone, Alvarado imprisoned two important Aztec leaders and killed several others. Tensions exploded when Alvarado ordered a massacre during the spring festival of Huizilopochtli. When Cortés returned in June 1520 the situation was dire. Communications and entrances to the city were cut off. The Spanish outside the city had no food supplies and a severe shortage of drinking water. Cortés had Moctezuma try to pacify his people by speaking to them from the palace, but the emperor was greeted with a storm of stones and arrows, wounding him badly. Moctezuma died a short time later, but whether he died from his injuries or whether the Spanish killed him, seeing that he was no longer of use to them, is unknown. The news of Moctezuma's death caused uproar in the city. The Spanish tried to flee unnoticed but were caught. Hundreds of canoes closed in on the city from all sides.
The Aztecs recaptured their city with Cortés's men fleeing the city, followed by arrows and rocks. Some found their way to a causeway out of the city. Some others, like the troops of Juan Velázquez, were forced to retreat toward the center of the city, where they were captured and sacrificed. When night fell, Aztec attacks on the Spaniards eased. Cortés took advantage of this to cross the causeway to a place called Popotla. Here is still found an ahuehuete tree called the "Tree of the Sad Night" because Cortés supposedly wept here after his defeat. At least 600 of the Spanish were killed (some estimates state over 1,000), many weighed down by the gold they were carrying; several thousand Tlaxcalans were probably lost, too.
At Tlaxcala, Cortés pacified his indigenous allies and rebuilt his military force. The Aztecs thought the Spaniards were permanently gone. They elected a new king, Cuauhtemoc. He was in his mid-20s, the son of Moctezuma's uncle, Ahuitzotl, and was an experienced leader.
After regrouping in Tlaxcala, Cortés decided to lay siege to Tenochtitlan in May 1521. For three months, the city suffered from the lack of food and water as well as the spread of disease brought by the Europeans. Cortés and his allies landed their forces in the south of the island and fought their way through the city, street by street, and house by house. The Spanish pushed the defenders to the northern tip of the island. Finally, Cuauhtemoc had to surrender in August 1521.

### Refounding as Mexico City

With Tenochtitlan in ruins, the victorious Cortés first settled himself in Coyoacán on the lake shore at the southern edge of Lake Texcoco. He created the ayuntamiento or town council of the Spanish capital there, so that he could choose where the city would finally be. No one but Cortés wanted to rebuild the Aztec site. Most of the other conquistadors wanted the new city to be closer to the mountains, pastures and groves they would need for supplies, for example in Tacuba or in Coyoacán. Some accounts state that the Aztec islet was chosen because its location was strategic, allowing for rapid communication by boat to communities on the shorelines. However, the decision was Cortés's alone. According to Bernardino Vázquez de Tapia, Cortés's reason was cultural. Leaving the site as it was would leave a memory of what was and would perhaps allow for a rival city to emerge. So the site was chosen so that all remains of the old empire could be erased. Major flooding in the early seventeenth century, however, raised again the question of where the capital should be located, with elite property owners facing losses if the capital were moved.
Although the fall of Tenochtitlan was a swift and definitive occurrence, this did not imply that the Spanish domination of the entire city, or the rest of Mexico, would be a rapid process. Indigenous cooperation in the destruction of Aztec power ensured that Cortés would have to take allied interests into consideration as well. In a number of ways, this made the Spaniards another factor in the ongoing political conflicts between rival native peoples, not to mention that Spanish were vastly outnumbered. For much of the colonial period, parts of Mexico City would remain very indigenous in character, with elements of these cultures surviving into modern times. Two separate parts of the capital were under indigenous rule, San Juan Tenochtitlan and Santiago Tlatelolco, with Nahua governors who were intermediaries between the indigenous population and the Spanish rulers, although the capital was designated a ciudad de españoles (Spanish city).
Cortés did not establish an independent, conquered territory under his own personal rule, but remained loyal to the Habsburg Emperor Charles V, who was also King of Spain and its associated European territories. Although Cortés was portrayed to the Spanish court as an ambitious and untrustworthy adventurer by his enemies, he sought to prove his loyalty. First, he wrote the Five Letters to explain what he had done and why, and between 1528 and 1530, he traveled to see the emperor in Toledo, Spain. However, the emperor decided not to appoint him as governor of New Spain but instead to grant him the noble hereditary title of Marquis of the Valley of Oaxaca, with vast numbers of tributary indigenous people there and elsewhere. Though substantial offering, Cortés felt betrayed and embittered by the refusal of the emperor to grant him governorship of New Spain. The first viceroy Don Antonio de Mendoza of the new Viceroyalty of New Spain arrived in Mexico City fourteen years later. But Mexico City had long since been the major settlement of "conquerors and immigrant [Spaniards, who] for their own reasons already made ... Mexico City their principal [seat]" before the establishment of the high court (Audiencia), the archbishop, and the viceroy. The town council (cabildo) of the city had power that extended far beyond the city's established borders, due to the existence of areas on the mainland that in the prehispanic period were subordinate to Tenochtitlan. Such was approved by Charles V in 1522, authorizing the city to step into rural affairs to "protect and benefit" indigenous people as well as the Spanish.
Between late 1521 and mid-1522, Alonso García Bravo and Bernardino Vázquez de Tapia were tasked with the layout of the new Spanish city. They were assisted by two Aztecs, but their names are lost to history. The Spaniards decided to keep the main north–south and east–west roads that divided the city into four and the boundaries of the city were set with an area of 180 hectares, which was divided into 100 blocks. There were eight principal canals in the Aztec city, including the one that ran on the south side of the main plaza (today Zócalo), which were renamed.
Around the main plaza, which became the Plaza Mayor or Zócalo in the colonial period, Cortés took over what were the "Old Houses" of Axayacatl and the "New Houses" of Moctezuma, both grand palaces, for his own. Other conquistadors of the highest rank took positions around this square. In the northeast corner, Gil González Dávila built his house at the foot of the old Aztec main temple. To the south, on what is now Avenida Pino Suárez were the homes of Pedro de Alvarado, and the Altamirano family, cousins of Cortés. To the north of the plaza, the Dominicans established a monastery, in an area now known as Santo Domingo. Most of these houses were built to be residences, warehouses or stores, and fortresses all at once.
The Spaniards began to build houses, copying the luxury residences of Seville. Being of firmer ground and less subject to subsidence, the area east of the main plaza was built up first, with the lake's waters up against the walls of a number of these constructions. The west side grew more slowly as flooding was more of an issue, and it was farther from the city's docks that brought in needed supplies.
The Spanish may well have found "Tenochtitlan" hard to say. They did shift the accent from Nahuatl pronunciation from Tenochtítlan (with the standard emphasis on the penultimate syllable) to Tenochtitlán. and eventually adopted the city's secondary name "Mexico", the "place of the Mexica" or Aztecs. For a period, the city was called by the dual name Mexico-Tenochtitlan, but at some point, the capital of the viceroyalty's name was shortened to Mexico. The name "Tenochtilan" endured in one of the capital's two indigenous-ruled sections, known as San Juan Tenochtitlan.

## Colonial period 1521–1821
### Growth of city

After the conquest, the Spaniards generally left the existing Nahua city-states or altepetl largely intact, but Mexico City was an exception since it became the seat of Spanish political power. It was established as a ciudad de españoles (city of Spaniards) and initially kept the remnants of its prehispanic place name, being called "Mexico-Tenochtitlan". No longer the seat of Aztec power, the Spaniards allowed two areas to be ruled through Nahua governors (gobernadores) and town councils (cabildos), separate from the Spanish city council. San Juan Tenochtitlan and Santiago Tlatelolco became the mechanism for the crown to rule through indigenous intermediaries, particularly important in the Spanish capital since it also had a significant indigenous population. San Juan Tenochtitlan and Santiago Tlatelolco were not called by the Nahuatl term for polity, altepetl, but rather "partes" or "parcialidades" of Mexico City, with their new place names having a Christian saint's name preceding the prehispanic designation, in typical colonial fashion. The structure in these two indigenous-ruled sections of the capital were on the same pattern of indigenous towns elsewhere in central Mexico. In the sixteenth century, these indigenous political structures mobilized tribute and labor rendered to the Spanish capital. Even though prehispanic Tenochtitlan-Tlatelolco was built on an island in the middle of the major lake system, they had political power over holdings on the mainland, a standard pattern of scattered rather than compact settlement and rule. These mainland holdings or estancias rendered tribute and labor in the prehispanic period; in the colonial period this pattern continued during the early colonial period, but during the later period (ca. 1650–1821), the pattern broke down and estancias were separated.
The city grew with buildings all near the same height and with the same terraced roofs (azoteas), with only the tower and cross of the convent of San Francisco peaking up from above it all. This profile was due to royal decree. Even the new cathedral being built had limitations as to its height. Near the end of the 16th century however, there was a proliferation of churches with bell towers, leading to a zigzag profile of the city, which was then later modified by church cupolas. For centuries afterward, this profile remained constant with only the continuous building of the main Cathedral making any change in the skyline. In the 19th century, the tallest structures were all churches. In addition to the Cathedral, there were the bell towers and cupolas of Santa Teresa la Antigua, the College of Saints Peter and Paul and the chapel of San Felipe Neri as landmarks.
The new city inherited much of the old city's look, oriented to the four cardinal directions with both canals and streets to move people and goods. However, the canals had already begun to shrink due to efforts to make the land streets wider.The first public building was called Las Atarazanas, where the brigantines used to lay siege to Tenochititlan were kept, at a place called San Lázaro. Shortly thereafter, the Palacio de Ayuntamiento was started, with the first coin production facilities. Mechlor Dávila built the Portales de Mercadores on the southwest side of the main plaza. Las Casas Consistoriales was built on the south side next to the Palacio de Ayuntamiento, which later became known as the Casa de las Flores.
The first extension of the originally laid city occurred on the north and east sides, taking over lands originally held by native peoples. One example is the neighborhood known as Lecumberri, founded by Basques, meaning "new, good land."
In 1600, the city grew again, towards the east to what is now the Circuito Interior and to the north towards Tlatelolco, which was then called Real de Santa Ana, stopping at the Calzada de los Misterios, which was a pre-Hispanic processional route to the sanctuary of Tonantzin, the mother of the gods in Tepeyac.

### Flooding, the Desagüe, and environmental changes

Since Mexico City was built on an island in the center of a large but shallow lake system, flooding became a serious issue during the colonial period. Spaniards denuded hillsides of their trees from the early conquest era on, so that mud and silt made the lake system even shallower, exacerbating the periodic flooding. Spaniards had not maintained the Aztec drainage system, which included a major dike. Major floods in Mexico City were recorded in 1555, 1580, 1604, and 1607, indigenous labor was diverted when crown officials undertook a major project to divert water via a drainage system, known as the Desagüe. In 1607, 4,500 Indigenous people were drafted to build the 8-mile-long combination drainage ditch and tunnel and 1608, the work was continued with 3,000. Flooding was controlled in the short term, and in subsequent years the Desagüe infrastructure was not maintained. In 1629, rains inundated the capital and flood waters remained in the capital for the next few years. Viceroy Don Rodrigo Pacheco, 3rd Marquis of Cerralvo, the Mexico City council (cabildo), secular and regular clergy, and elite Spanish residents of Mexico City combined efforts to provide immediate relief, and taxes and diversion of indigenous labor to construction of the Desagüe aimed at dealing with the long-term problem of flooding. A number of Spaniards moved to dry land to the nearby settlement of Coyoacán (now part of Mexico City), increasing the displacement of indigenous ownership of land there. In 1630, there was a serious proposal to move the capital to dry land rather than continue dealing with constant flooding. Elite Mexico City property owners and the city council opposed the plan, since they would incur huge real estate losses. There was another major push to deal with flooding, but the pattern of neglect of the desagüe infrastructure and subsequent inundation of the capital recurred, with flooding in 1645, 1674, 1691, 1707, 1714, 1724, 1747 and 1763. Floods continued into the early republic after independence.
From the early eighteenth century, the city was able to grow as the waters of the lake receded. In 1700, the city advanced towards the east and south and west, as the north was still bounded by water. To the west, it expanded to what is now Balderas Street. In the latter half of the 18th century the populated area reached eastward to the lakeshore, which then was just beyond the now Circuito Interior and the La Merced Market. To the south began to appear houses in an area now called Colonia Doctores. To the west, following what is now Avenida Chapultepec towards the Ciudadela, now the National Library, near Metro Balderas. To the north past Tlatelolco and to the south to Topacioa and the now Calzada de la Viga.
After independence, there were continued attempts to complete the drainage project, with activity in the early 1830s. During the U.S. invasion of the valley of Mexico, its army made a study of the problem, but the withdrawal of U.S. forces with the Treaty of Guadalupe Hidalgo put an end to that attempt. During the Liberal Reform of the 1850s, there was a revived plan for solving the problem, settling on a plan proposed by Francisco de Garay for a series of open canals to channel water out of the capital and through the mountains. As public health became more of a concern during the Porfiriato, the stench, uncleanliness, and perceived danger from the capital's water renewed efforts to implement the drainage project. Díaz created a commission to oversee work, but the project went further than merely controlling rainwater and stagnation and sought the expansion of water rights under its control for a growing population. This affected indigenous communities around the lake system. The commission sought foreign loans from the British firm of Pearson and Sons and foreign technology was utilized. The government authorized securing land for area through which the canal was to be built. Díaz considered the Desagüe a top priority, since Mexico's capital was considered a very dangerous place in terms of health.
When the engineering project was successfully finished the cycle of flooding finally ended. The lake waters ceased to threaten the capital as they disappeared in the modern era.

### Political power

By the 1530s, Mexico City was given jurisdiction over other town councils of New Spain and quickly established itself as the most populous and powerful city in the Americas. Like that of the Aztecs, the Spaniards' grasp extended well beyond the capital and the Valley of Mexico—only much farther. As the site of the viceroyalty of New Spain and archbishopric of Mexico, as well as economic elites, Mexico City was the center of power. Socially, the viceregal government and ecclesiastical authorities remained the pillars of Spanish colonialism. Its prestige as representing civilization allowed the colonial system to function during the long period from the 1640s to the 1760s when crown authorities in Mexico City were too weak politically to regulate much of the economic activities over such a vast territory. These institutions' close association with Mexico City also ensured this city's dominance in the political territory of New Spain, providing the links that kept the vast and expanding empire together.

### Religious power

As the seat of the Archbishopric of Mexico and the site of many diocesan institutions and those of mendicant orders and the Jesuits, and nunneries, Mexico City had a concentration of religious institutional power. The Metropolitan Cathedral of Mexico City was built over an extended period of time and designed to show the religious power of the Catholic Church. Built on the Plaza Mayor, or Zócalo, its architecture reflected several styles of Spanish Colonial architecture.
Despite this concentration of Catholic power, the indigenous population's understanding of Catholic doctrine and practice was not thorough, even in the capital itself. Residual native practices survived and were reflected in the natives' practice of the new faith. Franciscan friar Bernardino de Sahagún suspected that the emerging cult of the Virgin of Guadalupe, which is said to have originated with the vision at Tepeyac Hill to the north of the city's borders in 1531, represented a post-Conquest adoption of the Aztec cult of Tonantzin. He was also concerned that the prior cult of Quetzalcoatl would find its way into the new religion by equating this god with the Apostle Thomas, as an earlier attempt to evangelize the indigenous people before the Spanish conquest.
The Spanish also brought with them the Inquisition as a social and political tool. Public hangings and even burnings, not unusual in Europe at the time, were also used in New Spain, especially in Mexico City, as demonstrations of the joint power of the Church and the State over individual actions and social status. One group that suffered during this time were the so-called "crypto-Jews" of Portuguese descent. Many converted Portuguese Jews came to New Spain looking for commercial opportunities. In 1642, 150 of these individuals were arrested within three or four days, and the Inquisition began a series of trials on suspicion of still practicing Judaism. Many of these were merchants involved in New Spain's principal economic activities. On 11 April 1649, twelve were burned after being strangled and one person was burned alive. A similar fate was in store for those found guilty of homosexuality. Men were burned at the stake in 1568, 1660, 1673 and 1687 after being denounced. While not as likely to be executed, scholars had to be careful at this time, too. Academics such as Fray Diego Rodríguez who advocated the separation of science and theology found themselves the subject of investigations by the Holy Office. Booksellers who did not have their inventory approved by the Church faced fines and possible excommunication.
* Palace of the Archbishop of Mexico City, now a museum
* Church of Santo Domingo, Mexico City
* Temple of San Felipe Neri "La Profesa", Jesuit church, built between 1597 and 1720.
* La Soledad Church, originally Augustinian, secularized and rebuilt as a neoclassical church 18th c
* La Santísima Church, built in the 18th c.
* 17th c. Jeronymite convent where Sor Juana Inés de la Cruz lived, now the University of the Cloister of Sor Juana
* La Enseñanza Church, 18th c. nunnery
* The 18th-century Convent of Corpus Christi, built for elite indigenous women

### Economic power

Economically, Mexico City prospered as a result of its primacy. It was the capital of the viceroyalty, seat of the archbishopric, residence of civil and religious officials of all ranks, as well as wealthy merchants who engaged in international trade, but also the center of much regional trade. The establishment of a consulado de mercaderes (merchant guild) in Mexico City indicates the concentration and organization of this economic elite.
The consulado was founded in Mexico City in 1594, controlled by peninsular wholesale merchants who dealt in long-distance trade, who often married into local elite families with commercial ties. Their assets had to amount to at least 28,000 pesos. Although they were not supposed to deal in local retail trade, they often did some indirectly. They mainly lived in Mexico City and had positions on the city council cabildo. A number of them were connected to the crown mint in the capital. They diversified the assets locally, investing in urban real estate. In the eighteenth century, as New Spain's economy boomed, consulados were established in the port of Veracruz and in Guadalajara Mexico, indicating increased trade and the expansion of the merchant elite. The consulado in late colonial Mexico had approximately 200 members, who divided themselves into two factions based, the Basque and Montañés, even though some were from neither of those Iberian regions. American-born merchants came to be part of the consulado in the later colonial period, but a small number of peninsular merchants dominated. Goods were shipped from the Spanish port of Cádiz to Veracruz, but many of the goods were produced elsewhere in Europe.
Since Mexico City was the hub of so much sustained economic activity, the capital also attracted large numbers of skilled artisans, who often organized themselves into guilds to protect their monopoly on production for a relatively small market.$^{:67}$
Unlike Brazil or Peru, New Spain and its capital had easy contact with both the Atlantic and Pacific worlds. In fact, the Philippines were colonized and evangelized from Mexico City rather than directly from Spain itself. From the late 1560s until 1813, the annual Manila galleon took Mexican silver from the port of Acapulco across the Pacific Ocean to Manila, in exchange for Chinese silks and porcelain from Canton. The viceroy in Mexico City sought to restrict cargoes and frequency on the grounds that the Asiatic trade diverted silver from the principal route which was to Europe. There were also attempts to restrict, then prohibit, trade between Peru and Mexico City in the late 16th and early 17th century, with the objective of keeping control of Peruvian silver. The overall goal was to keep Spain's colonies dependent on trade with the motherland, rather than with each other and even less with colonies of other European powers. Although the viceroy's attempts were not 100% effective, they were effective enough that Mexico City merchants lost control of the Pacific trade, which fell under the control of contrabandists operating from the smaller ports in Guatemala and Nicaragua.

### Population of Mexico City
#### Size

Population figures for the city are inexact for Spaniards, mixed-race castas, and indigenous. Some idea of the indigenous can be discerned from tribute records. In 1525, the city had perhaps 22,000 indigenous inhabitants, dropping precipitously starting around 1550. A figure for Tenochtitlan tributaries in 1562 is 12,971. The estimates of the European population in Mexico City is also imprecise, with figures coming from a variety of sources. In 1525 there were 150 households occupied by Spaniards, with the European population increasing steadily during the entire colonial period. The highest estimate for the colonial era is by Alexander von Humboldt, who estimated ca. 1802 that there were 67,500 whites in Mexico City.
The size of Mexico City's population and its demographic contours have been enduring questions for crown officials as well as modern scholars. There were major epidemics that affected the population, starting with the smallpox epidemic of 1520 that was a factor in the Spanish Conquest of the Aztec Empire, but there were other major epidemics throughout the colonial period. There were estimates taken in the late seventeenth century, with the largest and most detailed census mandated by Viceroy Revillagigedo in 1790. In 1689, there was an estimate of 57,000 residents. An estimate for 1753 based on a partial census mandated by the Audiencia put the population at 70,000. In the period between 1689 and 1753, there were at least nine epidemics. The Revillagigedo census of 1790 counts 112,926 residents, a significant increase. This might be due to migration to the city accelerating. An 1811 census done by the ‘'Juzgado de Policía'’ put the number even higher, at 168,811, which might well reflect displacement from the countryside from the insurgency of Miguel Hidalgo and his successors. The census of 1813 done by the city government (Ayuntamiento) shows a significant decrease to 123,907, perhaps showing the return of short-term migrants to their home communities following the waning of the insurgency, but also possibly "fevers" that affected the population.

#### Racial composition

Although Mexico City was designated the capital of the viceroyalty, it still had a significant non-white population throughout the colonial period. In the early period after the conquest, the Spanish population played a pivotal role in the capital.
In his analysis of the 1790 census of Mexico City and its surrounding area, Dennis Nodin Valdés compared the population of the capital with the census of the Intendancy of Mexico in 1794. The total number of Mexico City residents counted in 1793 was 104,760 (which excludes 8,166 officials) and in the intendancy as a whole 1,043,223, excluding 2,299 officials. In both the capital and the intendancy, the European population was the smallest percentage, with 2,335 in the capital (2.2%) and the intendancy 1,330 (.1%). The listing for Spaniard (español) was 50,371 (48.1%), with the intendancy showing 134,695 (12.9%). For mestizos (in which he has merged the castizos), in the capital there were 19,357 (18.5%) and in the intendancy 112,113 (10.7%). For the mulatto category, the capital listed 7,094 (6.8%) with the intendancy showing 52,629 (5.0%). There is apparently no separate category for blacks (Negros). The category Indian showed 25,603 (24.4%), with the intendancy with 742,186 (71.1). The capital thus had the largest concentration of Spaniards and castas, with the countryside being overwhelmingly indigenous. The population of the capital "indicates that conditions favoring mestizaje were more favorable in the city than the outlying area" and that there were more high status occupations in the city.
Further analysis of the two censuses found that the population of the capital was older and had more women. Women migrated to the capital in higher numbers than men from the surrounding countryside.

#### Racial residential patterns

In studying the 1811 census, there is no absolute segregation by race. The highest concentration of Spaniards was around the traza, the central sector of the city where the civil and religious institutions were based and where there was the highest concentration of wealthy merchants. But non-Spaniards also lived there. Indigenous people were found in higher concentrations in the sectors on the fringes of the capital. Castas appear as residents in all sectors of the capital.

### Nobility in Mexico City – "City of Palaces"

The concept of nobility transferred to New Spain in a way not seen in other parts of the Americas. A noble title here did not mean one exercised great political power as one's power was limited even if the accumulation of wealth was not. Between the 16th and 18th centuries, most of those who had titles gained them after their families had accumulated wealth over several generations. Many of these nobles made their money outside of the capital at large haciendas or in mining but spent their fortunes in the capital. Those who made their money in the city were usually wholesalers from lower social backgrounds. The merchant-financiers became almost as prominent as the landowners because they were the decisive element of the city's economy. Many of the leading figures were of Spanish origin, although their principal economic interests and family connections were within New Spain. For example, the Andalusian, Pedro Romero de Terreros, who became Count of Regla in 1768, made his money in silver mining at Real del Monte, near Pachuca, from 1742. This blending of wealth of landowners and merchant-financiers led to a blending of traditional and modern practices. Matrimony and personal ties continued to be the principal means of solidifying business interests. Nephews, other relatives and friends formed broad networks of interest over a wide geographical area from the capital cities into the countryside and through the span of economic activities. The landowners, however, remained in a slightly higher social position because their livelihoods stemmed from their close working arrangement with the colonial state.
Some landowners' holdings were almost kingdoms. Between the 1730s and the 19th century, the Marquis of San Miguel de Aguayo had amassed properties that combined were about two-thirds the size of Portugal, or 19,000,000 acres (77,000 km$^2$). These estates were centered in the modern-day state of Durango, and their specialty was sheep-raising. Meat from their stock supplied Mexico City and wool was sold to various textile workshops. The Aguayos left these estates in the hands of administrators, backed by armed guards to ward off indigenous attack, to live off the revenues in Mexico City, where they possessed four palatial residences. Their title had been awarded in 1682, but the land purchases by the family dated from the 1580s.
The concept of nobility in Mexico was not political but rather a very conservative Spanish social one, based on proving the worthiness of the family, not the individual. For an individual to receive a noble title, he would have to prove his family's bloodline as well as their loyalty to God and king for a number of generations prior. Such a quest was costly but once a title was secured the costs did not stop there.
Nobles in New Spain had to continually reinforce their devotion to both God and king. To show their piety, most nobles donated temporal goods to the Roman Catholic Church, by building churches, funding missionary activities and charities. Sometimes nobles would also hold religious office or give one or more children (usually daughters) to a religious vocation but this was relatively rare. Demonstrating loyalty to king meant paying taxes to maintain their titles, sometimes purchasing military rank as well.
Their last duty was to maintain a certain show of luxury. It was not a case of "keeping up with the Jones'", but rather a requirement of the position. Families that could not keep up a certain level of luxury were scolded by royal officers as not honoring their title. Such conspicuous consumption manifested itself in dress, jewels, furniture and especially in the building of mansions and palaces.
The pressure to build the most opulent residence possible reached its height in the last half of the 18th century. Nobles leveled old buildings, using their Aztec stones and Spanish bricks to build more fashionable Baroque and Neo classic style mansions. Many of the most costly were on what was called San Francisco street (now Madero street) and near the Alameda Central. Near the Alameda were the homes of the Marquis of Guardiola, of the Borda family and the house of the Marquis of Prado Alegre as well as the home of the Counts of the Valley of Orizaba who covered the entire façade with talavera tiles from Puebla. On San Francisco Street, the most famous house was that of the Marquis of Jaral. It was a former convent that the marquis converted into a replica of the royal palace of Palermo for his daughter and her Sicilian husband. Later it was the home of Felix Calleja and then Agustín de Iturbide, who accepted the crown of Mexico from its balcony. Today it is known as the Palace of Iturbide.
Most of these palaces still remain in the city center. Their abundance led Charles Joseph Latrobe, a man of high standing in Australia, to name Mexico City the "city of palaces" in his book "The rambler in Mexico." This moniker is often erroneously attributed to the famous scientist and savant Alexander von Humboldt, who traveled extensively through New Spain and wrote The Political Essay of the Kingdom of New Spain, published in 1804.
Such need for pomp made for an extreme social class difference. Alexander von Humboldt reported that foreigners were often horrified at the differences between how the nobles lived and the misery of the common people. In the late 18th century and early 19th century, there was a strong desire among nobles to transform colonial absolutism to something like an autonomous, constitutional state. More specifically, they looked for more power in the rural regions outside of Mexico City where their holdings were. There was an experience in such decentralization in September 1808, when tensions between the metropolis and the other regions of New Spain were high. Then regional elites used this situation to subvert the colonial government in the city, turning to popular mobilization against the elite of Mexico City when they failed to subvert the colonial militia.

### The urban poor in Mexico City

Mexico City also has a long tradition of urban poverty, while at the same time being home to the largest concentration of wealthy people in New Spain. There were institutions designed both to control the urban poor, but also aid them, created by private donors, the Church, and the crown. The establishment of the Nacional Monte de Piedad, the pawnshop still in operation in modern Mexico City, allowed urban dwellers who had any property at all to pawn access to interest-free, small-scale credit. It was set up in 1777, by the Count of Regla, who had made a fortune in silver mining, and the pawnshop continues to operate as a national institution in the twenty-first century, with its headquarters still right off the Zócalo in Mexico City with branches in many other places in Mexico. The Count of Regla's donation is an example of private philanthropy in the late colonial period. A much earlier example was the endowment that conqueror Hernán Cortés gave to establish the Hospital de Jesús, which is the only venue in Mexico City that has a bust of the conqueror. Another eighteenth-century example of private philanthropy that then became a crown institution was the ‘'Hospicio de Pobres'’, the Mexico City Poor House, founded in 1774 with funds of a single ecclesiastical donor, Choirmaster of the Cathedral, Fernando Ortiz Cortés, who became its first director. That institution lasted about a century, until 1871, going from a poor house or work house for adults to mainly being an orphanage for abandoned street children. The Mexico City Poor House was partially supported by another eighteenth-century institution, the Royal Lottery. There was also a foundling home established in 1767, the ‘'Casa de Cuna'’ (house of the cradle).
During the viceroyalty of Revillagigedo, there were attempts to control the public behavior of the poor in Mexico City. Ordinances such as forbidding public defecation and urination had little effect, especially since there was no alternative for the poor to relieving one's self on the street. Also forbidden were the discarding of trash buckets, dead dogs and horse in the streets and gutters. A local police force was tasked with creating order and tidiness. The crown also attempted to regulate taverns, where the poor congregated, drank, gambled and in the estimate of elites, generally got up to no good. Revillagigedo focused special attention on cleaning up the Plaza Mayor and the viceregal palace, removing pulque stalls, garbage, wandering dogs, cows, and pigs, moved the market area elsewhere. He had the area paved with cobblestones, and the area was illuminated with newly place streetlamps. The Alameda park was cleaned and the entrance to it was guarded to prevent the poorly clad plebe from entering. Public space was thus regulated cultural space, separating elites from the poor.
The founding of the Royal Cigar Factory was another eighteenth-century crown project, part of the establishment of the royal tobacco monopoly, which both brought significant revenue to the crown in the sale of cigars and cigarettes, but the factory in Mexico City and a few other major colonial centers, created thousands of good jobs for the urban poor including women.
As Mexico experienced a series of droughts and bad harvests in the eighteenth century, the crown set up granaries (alhóndigas) to store wheat and corn so that the price of basic staples did not soar for the urban poor. It was as much an act of charity as prudent state planning to prevent bread riots. Mexico City had experienced two major riots in the seventeenth century, one in 1624 that ousted the viceroy who attempted to eliminate excessive profits for grain and other goods by creole traders. The other was in 1692 where a mob burned the archbishop's and the viceroy's official residence. A first-hand account of the 1692 riot was recorded by seventeenth-century savant, Don Carlos de Sigüenza y Góngora.
Other institutions designed to protect and aid the vulnerable were the General Indian Court, founded in 1591, to give access of indigenous communities and indigenous individuals to justice and supported by a half-real tax to pay for lawyers. For women who needed protection, the Church created the recogimientos de mujeres, a kind of shelter for healthy women who voluntarily wished to live a sheltered life in a religious atmosphere; some other institutions for women were to reform prostitutes and were not voluntary. Both types were in decline when the Mexico City Poor House was established.
In the capital and other Spanish cities in New Spain (and later after independence in 1821), there was a population of léperos, a term elites gave to shiftless vagrants of various racial categories in the colonial hierarchical racial system, the sociedad de castas. They were considered a kind of criminal class, contributing to the disorder of Mexico City. Research has found that they included mestizos, indigenous people, and poor whites (españoles). Léperos were viewed as unrespectable people (el pueblo bajo) by polite society (la gente culta), who judged them as being morally and biologically inferior. Léperos supported themselves as they could through petty commerce or begging, but many resorted to crime. A study of crime in eighteenth-century Mexico City based on official arrest records of the two police forces of Mexico City indicates that léperos were "neither marginal types nor dregs of the lower classes. They consisted of both men and women; they were not particularly young; they were not mainly single and rootless; they were not merely indigenous and casta; and they were not largely unskilled." All of the popular stereotypes of a young rootless, unskilled male are not borne out by the arrest records. "The dangerous class existed only in the collective mind of the colonial elite." Claudio Linati depicts a barefoot and shirtless "lépero or vagabond", in the 1820s, lounging against a wall, smoking a cigarette with his dog gazing up at him. The scene suggests both his vice and laziness.
Arrest records are one of the few ways to get at empirical data about the urban poor. Not all arrests led to criminal cases and prosecuted, and not all prosecutions led to convictions. Formal prosecutions usually involved serious crimes against persons (homicide, aggravated assault), but also gambling. In the late colonial period, the police actively arrested the largest number of people (both men and women) for tavern violations, drunkenness, gambling, disorderly conduct, and violence, as well as the sexual crimes of "incontinence", i.e., what English law calls common-law marriage, living together without marriage, and promiscuity. They made arrests for other crimes only when a complaint was filed; these crimes included theft, vagrancy, family offenses, and debt.
Indigenous people were over-represented in arrest records, that is they were arrested at higher rates than their proportion of the population. They were most often arrested for drunkenness, theft, and violence. Non-Indians (‘'gente de razón'’, a category that included Spaniards, mestizos, mulatos, and other mixed-race castas) were arrested for financial crimes (gambling, debt), tavern violations, family offenses, vagrancy, and disorderly conduct. Indigenous people were jailed separately. Women were arrested less frequently than men, but they were still about a quarter of total arrests. Women were arrested for violence, mainly violence against other women. An early nineteenth-century lithograph by Claudio Linati shows two indigenous women fighting, each with a baby on her back. Women also attacked men whom the woman knew as an acquaintance or a common law partner; less frequently they attacked their legitimate husbands. One explanation for the pattern of female violence among the poor in Mexico City is that their position within the family was subordinate, that there was a pattern of male domestic violence "often growing out of a need to demonstrate virility or control over the wife", resulting in the wife violently acting out against others outside of the nuclear family. Women were also arrested for desertion at higher rates than men, mainly when the women were in their twenties. Arrest records indicate that many of these women had provincial origins and the women migrated to the capital leaving a spouse behind. Their arrests for desertion indicates their spouses wanted them reunited with the family. In trials the women often stated that nonsupport or domestic abuse was the reason they deserted.
Men also deserted their wives, but were arrested in smaller numbers (perhaps not reflecting the real extent of their desertion); these men abandoning their families did so between the ages of 20 and 49. In their trials, many men cited their inability to support their families as the reason for desertion. The insecurity of employment of the lower classes meant that there was continuous stress on the urban poor families, particularly for unskilled or semi-skilled workers, although artisans also abandoned their families.

## Independence to the Mexican Revolution
### Mexican Independence and Iturbide

When rebellion against Spanish rule broke out, interests outside of Mexico City would be represented by Father Miguel Hidalgo y Costilla, José María Morelos and others. While the nobility in Mexico City also did not like the absolute colonial system, their goal was limited representation and autonomy within the Spanish empire. They decided to make their stand in 1820, after the rural insurgency had been going on for several years, choosing Colonel Agustín de Iturbide to push their interests militarily. Iturbide had fought against Morelos between 1813 and 1816. However, between 1816 and 1820, Iturbide was becoming sympathetic to the idea of some degree of independence for Mexico. In 1821, Iturbide was the supreme commander of the royalist forces and had put down all but one of the major rebels, Vicente Guerrero. Iturbide decided to meet with Guerrero, after becoming convinced that independence was the only real course for Mexico. However, Iturbide's idea was a Mexican monarchy with ties to King Ferdinand VII of Spain. After switching sides, Iturbide chose to pressure the colonial government by repeating Hidalgo's strategy of closing in on the city from the surrounding area. Iturbide was able to succeed where Hidalgo had not because the Spanish-born commanders in the city supported Iturbide's idea of limited autonomy, and many the royalist forces were in the field battling insurgents like Guerrero. Iturbide's Army of the Three Guarantees (Independence, Union, Religion) entered Mexico City on 21 September 1821. On the following 27 September, Mexico was declared independent. The Mexico City nobles sought to preserve as much of the old as possible, and garnered the support of a substantial section of the royalist army to recreate central power. Their objective was to halt the devolution of power to the regions outside the city and the lower echelons of society. Shortly after his triumphant entrance into the city, Iturbide declared what is now known as the First Mexican Empire, with himself as emperor, from the palace that now bears his name. The coronation of Agustín as emperor and his wife Ana María as empress took place amid much pomp and circumstance on 21 July 1822 at the Cathedral of Mexico City. The Archbishop Fonte presided over the anointment of the Emperor who following Napoleon's example, crowned himself. Following his coronation, the new empire was politically and financially unstable. Iturbide was accused of taking too much power for himself, and his main rival was Antonio López de Santa Anna. In the spring of 1823, Iturbide offered his abdication, which was accepted by his political opponents and then left the country for Europe. Mexico was then declared a republic. The republican constitution of 1824 established Mexico City as the nation's capital. Unrest followed for the next several decades, as different factions fought for control of Mexico.

### U.S.–Mexican War

During the Mexican–American War, American forces marched toward Mexico City itself after capturing Veracruz. President Santa Anna first tried blocking their way at Cerro Gordo in the Veracruz highlands. The first battle to defend Mexico City itself was the Battle of Contreras. A fortified hacienda in the town of San Antonio covered the southeastern approach, while the town of San Ángel covered the southwestern. Between them lay a vast, seemingly impenetrable lava field, called El Pedrégal. General Gabriel Valencia decided to move his troops from San Ángel to the then town of Contreras. Despite being forewarned of U.S. intentions by a tactical mistake, the Mexicans found themselves outgunned by the invading army at Contreras. This allowed the Americans to cross the Pedrégal and move in on the Mexican troops at San Antonio from behind. The assault on the carefully laid defenses at San Antonio became known as the Battle of Churubusco. Knowing of the Americans' approach, Santa Anna ordered General Pedro María de Anaya to move his troops to a monastery in Churubusco. While Anaya's position was eventually overrun, he held off the Americans for some time. However, the Mexican army lost 10,000 defenders. The Battle of Molino del Rey was the last just before the Americans entered the old city itself. The war ended with the attack of Chapultepec Castle, headquarters of the military college, where young students defended the castle. In this place died in the battle the Niños Héroes, students of the college with ages from 13 to 19 years. General Gideon Pillow and his 2,500 men led the assault, starting from the Molino del Rey to the west of Chapultepec. General John Quitman entered in from the south to cut Chapultepec off from reinforcements, while General David Twiggs fought against positions further east. Inside the walls, General Nicolás Bravo realized that his 1,000 men were too few to hold the castle, but he attempted to do so. Mexican troops on the western slope of the castle held for a while, but Pillow's men captured the castle by 9:30 am the day of the attack. To end the war officially, American and Mexican representatives met at the Villa of Guadalupe Hidalgo, across from the shrine of the patron saint of Mexico, in what is now the far north of the city. They signed the Treaty of Guadalupe Hidalgo, and then celebrated a mass together at the basilica.
* Battle map of Churubusco
* Battle map of Chapultepec

### Reform War and Second Empire

Peace did not last long. Santa Anna's losses to the Americans created great discontent among his political opponents who coalesced to call themselves the Reform movement or the Liberals. Those who supported Santa Anna's regime and the power of the Catholic Church were called the Conservatives. The Reform War lasted from 1857 to 1861. For a time, the two factions had parallel governments with the Liberals in Veracruz and the Conservatives in Mexico City. When the Liberals were victorious, Liberal president Benito Juárez moved his government to the capital city. Since the Catholic Church was as much a target of the Reform movement as the government was, a number of ecclesiastical buildings were torn down or turned to other uses. The liberals' urban program was to transform "an ecclesiastical capital into a secular one." However, Juárez was soon faced with a new threat when he suspended payments for foreign powers of money borrowed by the conservatives, which sparked the French intervention in Mexico. The intervention, supported by Mexican conservatives, installed Emperor Maximilian as the ruler of a newly created monarchy, the Second Mexican Empire.
Emperor Maximilian undertook an accelerated program of urban renovation under the supervision of Mexican architect, Francisco Somera. Somera had served on the city council of the capital and dealt with the city's infrastructure, such as roads, sewers, canals, and pavement. His portfolio and expertise meant he was concerned with the ongoing problem of flooding in the capital, especially during heavy rains, which the major colonial-era project of drainage, the Desagüe, had not solved. He was also significantly involved with the expansion of the city from its historic urban core.
For the most part, growth of Mexico City in the 19th century, was based on extending the rectangular layout of the original Spanish colonial city, even if its borders had an irregular, even zigzag, appearance. In 1865, Emperor Maximilian had a wide avenue, Paseo del Emperador or Paseo de la Emperatriz, planned by Francisco Somera, and built to connect the emperor's residence at Chapultepec Castle with the National Palace in the downtown core. All along this avenue there were plans to place statues of heroes of Mexican history, which were not realized until the regime of Porfirio Díaz, starting in 1877. However, the thoroughfare extends southwest to northeast, breaking the north–south, east–west orientation of roads before it. With the ouster of the imperial French in 1867 and return to Mexico City of republican president Benito Juárez, the avenue was initially renamed Calzada Degollado and then in 1872 changed to Paseo de la Reforma.

### Porfiriato (1876–1910)

President Porfirio Díaz ruled the nation for more than three decades between 1876 and 1910. During this time, he developed the city's infrastructure, such as roads, schools, transportation, and communication systems. He also encouraged foreign investment and laid the groundwork for industrial development. In Mexico City, these improvements were most apparent, since this is where government elites, foreign investors, and domestic entrepreneurs lived and worked, while the countryside and smaller cities and pueblos languished.
With the ouster of the French occupiers and the political exile of their conservative Mexican supporters, liberalism put its stamp on Mexico City in the form of new monuments and the renaming of streets. Most prominently, the new, wide avenue became Paseo de la Reforma, with statues of liberal heroes and others important to Mexican history lining its route. The monument mania on the Paseo started in 1877 with the Monument to Christopher Columbus donated by Mexican railway magnate Antonio Escandón designed by French sculptor Charles Cordier, followed by the Monument to Cuauhtémoc, both in major traffic circles (glorietas).
As with earlier regimes, Diaz re-purposed a number of older buildings. One was Belem Prison, a colonial-era building that was used to produce pseudoscience about criminals. The police had started to take photos of prisoners in Belem in the 1850s, to identify them in case of an escape. Diaz wanted to professionalize the police and the Mexico City Police adopted the Bertillon method to catalogue and identify repeat offenders. The Palacio de Lecumberri prison in Mexico City drew on the panopticon concepts of Jeremy Bentham and was completed in 1900. It became symbolic for Diaz's attempt to put criminals under visual surveillance.
In 1910, Mexico celebrated the 1810 Hidalgo revolt that initiated the independence movement in Mexico. Díaz had been in power since 1876 and saw the occasion of the centenary as an opportunity for the creation of new buildings and monuments and to invite world dignitaries to show off Mexico's progress. For buildings, much advance planning and other work was needed to have them completed in time for September 1910. During that month in Mexico City, there were "inaugurations of a new modern mental hospital, a popular hygiene exhibition, an exhibition of Spanish art and industry, exhibitions of Japanese products and avant-garde Mexican art, a monument to Alexander von Humboldt at the National Library, a seismological station, a new theater in the Escuela Nacional Preparatoria, primary schools, new buildings for ministries, and new large schools for teachers." On the actual anniversary of Hidalgo's grito, 16 September, Díaz inaugurated the monument to Independence, "the Angel".
* Bird's-eye view of Mexico City in 1890
* Belem Prison, a colonial building opened as a prison in 1886.
* Blueprint of Lecumberri Prison, which was used to incarcertate ordinary criminals as well as political prisoners, 1900–1976. It now houses the Archivo General de la Nación
* Monument to Cuauhtémoc erected during the Porfiriato, one of many statues of historical figures erected in Mexico City in this era.
* Museo Nacional de Arte, designed 1904 by Silvio Contri to be the Ministry of Communications building
* Benito Juárez Hemicycle, Alameda Central inaugurated 1910
* Palacio de Correos de Mexico, built in 1907 by Italian architect Adamo Boari
* Construction of the Palacio Legislativo, during the Porfiriato, construction stalled during the Mexican Revolution, photo by Guillermo Kahlo, 12 June 1912
* Palacio de Bellas Artes, construction started under Porfirio Díaz and stalled during the Mexican Revolution

### Mexican Revolution's impact

By the early 20th century, Mexico City was becoming a modern city, with gas and electric lighting, streetcars, and other modern amenities. However, the regime concentrated resources and wealth in the hands of a few people. The majority of the nation languished in poverty. Social injustice led to nationwide revolts, and ultimately the Mexican Revolution (1910–1917). The city was not untouched by the revolution. Battles were fought on its streets, and thousands of displaced villagers became refugees in the city. During the revolution, the city was briefly taken over by the famous revolutionaries Francisco "Pancho" Villa and Emiliano Zapata. While most of the Mexican Revolution was not fought within the city, one major episode of this era was. La decena trágica ("The Ten Tragic Days") was a series of events leading to a coup d'état in Mexico City between 9 and 22 February 1913 against President Francisco I. Madero and his vice president, José María Pino Suárez. After deposing President Porfirio Díaz and taking power in 1911, Mexicans expected Madero to make widespread changes in government but were surprised and disappointed to find Madero following many of the same policies and employing the same personnel as the Díaz government. This eventually resulted in revolts against the Madero regime. Madero's fear of these revolts led him to commission Victoriano Huerta as chief general of the Federal Army. Huerta was effective in putting down rebellions, but had ambitions that Madero was blind to. Military success gave Huerta power, and he saw an opportunity to make himself dictator. La decena trágica began when military academy cadets quartered in Tacubaya revolted and began an attack against the National Palace. Madero and Pino Suárez returned to the Palace to address the crisis, calling in reserves from other military academies and the forces of Felipe Ángeles in Cuernavaca to assist in defense. Meanwhile, Huerta convinced Madero to allow him to take over defense of the National Palace. Huerta betrayed Madero and Pino Suárez forcing Madero and Pino Suárez to sign resignations. On the night of 22 February, Huerta ordered Madero and Pino Suárez to be transferred to the Lecumberri prison, supposedly to be held for transfer to exile. Before the car reached the prison, it was pulled over by armed men and Madero and Pino Suárez were shot and killed.

## 20th century to present
### Loss of democracy and recovery

Mexico City lost its democratically elected mayor and legislature/city council in 1928, which left its urban middle class and workers without legislative redress. The mayor was appointed by the President of Mexico. Residents of the densely populated capital became dependent on the newly formed Party of National Revolution (PNR) to dress its concerns. During the Lázaro Cárdenas presidency (1934–40), the government reduced spending in the capital, leaving infrastructure, such as water, sewage, lighting, without resources. Cárdenas did not implement rent control or aid urban renters, and in 1938–39, renters attempted to gain advantage by organizing rent strikes. The middle class and the urban poor joined in the attempt. Not until the electoral reforms of the 1990s was the mayoral elections restored. In 1997 Cuauhtémoc Cárdenas won the position.

### Historic commemorations

In the historic center of Mexico City, the Plutarco Elías Calles administration (1924–28) began placing colonial-style tiles on street corners "on each street that has some history or legend that merits remembrance by means of their old names." This was part of the government's aim to shape public memory in the city, particularly of the Revolution. Many street names were changed to commemorate the deeds of revolutionary heroes, including Francisco Madero, José María Pino Suárez, whose democratically elected government was overthrown by military coup in 1913.

### Growth of the city

In 1900, the population of Mexico City was about 500,000. By the end of the 19th century, the perimeter of the city had noticeably grown again and by 1929, the boundaries lost any sense of regularity. The city had grown to reach Tacuba, Nextengo, Popotla, east of now Metro San Lázaro and Metro Tasqueña, Miguel Ángel de Quevedo to the south and Lomas de Chapultepec and Azcapotzalco to the west and north as the last of the lake dried up. The city continued to modernize at a rapid pace. Old palaces and colonial homes were demolished to make way for new roads and modern buildings. By 1924, Avenida de los Insurgentes, considered today one of the world's longest avenues, was being laid out.
The city would begin to extend south starting in 1905, breaking the Avenida Chapultepec/Arcos de Belen southern boundary that had existed for centuries. Colonia Hidalgo (now Colonia Doctores) was being established with Colonia Obrera and Colonia Roma being laid out in a rectangular fashion, similar to the older part of the city. Obrera was named after the artisans that populated the place when it was established, and Roma was for the upper-classes, reaching the height of its splendor between 1917 and 1922. Another wealthy neighborhood that was established at this time was Colonia Juárez, naming their streets after the capitals of Europe. In the first decades of the 20th century, the city extended north to the Río de Consulado, east to Metro Jamaica, west to Chapultepec and south to roughly were the Secretariat of Communications and Transportation building at Xola is now.
From the 1930s on, Mexico City would see an increase in the rate of growth of the city. Colonias Roma and Juárez prospered rapidly and this with the wide Paseo de Reforma to help with transportation, led to the establishments of colonias heading west such as Lomas de Chapultepec and Hipodromo, extending the city past the Chapultepec forest (now a park). The extension of Insurgentes Avenue southward to where the Chilpancingo Metro station is now, led to the establishment of even more colonias. Between 1928 and 1953, other western colonias such as Anzures, and Polanco for the wealthy, and colonias 20 de Noviembre, Bondojito, Gertrudis Sánchez and Petrolera for the working class arose with another additional 585 colonias.
By 1940 Mexico City had become not only the political and economic capital of Mexico, but also the world's largest megalopolis. Between 1929 and 1953, growth spread east to establish colonias Federal, Moctezuma and Jardín Balbuena, to the north and urban area included all of Azcapotzalco and reached Ampliacion Gabriel Hernández including Ticoman, Zacatenco and Santa Isabel Tola. To the west, the most notable growth was from Lomas de Chapultepec west to the limits of the State of Mexico. Areas such as Tacubaya, Villa de Guadalupe, Coyoacán and San Ángel were still considered separate entities. A major infrastructure project for mass transit was the ring road, or Anillo Periférico, completed in 1964. It allow for quick transit on the periphery of the city, and with easy access to the airport.
In the 20th century, the city began to grow upwards as well as outwards. The column with the Angel of Independence was erected in 1910 for the centenary of Mexican Independence, the ironwork Legislative Palace, Palacio de Bellas Artes and a building called La Nacional. The first skyscraper, 40-story Torre Latinoamericana was built in the 1950s. All of these were in the main core of the city, laid out in the sixteenth century.
A major departure in location and scale was the construction of the Ciudad Universitaria from 1950 to 1953 in the south of the city. It had a noticeable effect on subsequent architecture in the city. The most notable buildings are the Rectoría designed by Salvador Ortega, Mario Pani and Enrique del Moral, the Library, by Juan O'Gorman, Gustavo Saavedra and Juan Martínez de Velasco and the Science Building by Raúl Cacho, Eugenio Peschard and Félix Sánchez. Much of what makes the campus culturally significant is its huge murals that decorate the facades of many of the buildings. These murals were done by Diego Rivera, David Siqueiros and others, with themes relating to Mexican history and identity.
The 1968 Olympic Games brought about the construction of large sporting facilities such as the Palacio de los Deportes (Sports Palace), the Velódromo Olímpico and the 24 buildings of the Olympic Village.
The construction of the Mexico City Metro was not ready in time for the 1968 Olympics, but in 1969, Line 1, the "Pink Line" the underground rapid transit system of the city, was inaugurated by President Gustavo Díaz Ordaz. The subway system was a huge infrastructure project, designed to be mass transit for those in Mexico City without cars. There had been proposals for a subway system dating back decades, but political forces in favor of car owners (middle class and elites) blocked the plans for underground mass transit. The subway system allows for movement of large numbers of people to increasingly far flung areas of the city. When the Ciudad Universitaria opened, which relocated UNAM to the south of the city, there was no metro line.
Explosive growth in the population of the city started from the 1960s, with the population overflowing the boundaries of the Federal District into neighboring state of Mexico, especially to the north, northwest and northeast. Between 1960 and 1980 the city's population more than doubled to 8,831,079. Under relentless growth, Mexico City had lost its charm by the 1970s, when the government could barely keep up with services. Mexico City was choking in smog and pollution. Villagers from the countryside who continued to pour into the city to escape poverty only compounded the city's problems. With no housing available, they took over lands surrounding the city, creating huge shanty towns that extended for many miles.
Mexico City is still the cultural, economic, and industrial center for the nation. With a metropolitan-area population approaching 20 million, roughly equivalent to the entire state of Texas, it is a magnet of growth. People in large numbers still migrate from rural areas to the city in search of work and the other economic. Many of these immigrants settle illegally in the urban fringe with the hope that the government will eventually provide public services. The provision of water and wastewater service for the growing population of Mexico City is the problem air pollution was in the 1970s and 1980s. Such growth rates and patterns mean substandard potable water supplies and waste water treatment, if they exist at all. Over 70% of Mexico City's potable water from the aquifer below it, which is being overexploited, causing the city to sink.
The south of the Federal District contains a number of ecological reserves; one of the most important being the Ajusco reserve. Growth pushing of the edges of this reserve has been causing both economic and political struggles which include fraudulent real estate schemes, illegal development of ejidal property, along with popular resistance and opposition movements. A major problem is the illegal movement of the poor building shantytowns, then resisting eviction, often with violence, often until the government gives into demands to build popular-sector housing in the area. While such housing is needed, the whole process is ecologically destructive.

### Decline and revitalization of the city center

From Aztec times, the Centro Histórico used to be where the wealthy and elite lived. However, in the early 20th century, these classes began to move to areas west and southwest of the Centro, to neighbourhoods such as Colonia Juárez, Colonia Cuauhtémoc, Colonia Roma and Colonia Condesa. The Centro remained the commercial, political and intellectual center through the mid 20th century, although it was around this time that UNAM moved most of its facilities to the new Ciudad Universitaria. The reason for the decline of the city center was partly man-made and partly natural. In the 1940s, the city government froze rents so that until 1998, when the government repealed the law, tenants were still paying what they were in the 1950s. With no financial incentive to keep up their properties, landlords let their buildings disintegrate. The 1985 earthquake took its toll on a number of these structures, which were never fixed or rebuilt, leading to slums with and garbage-strewn vacant lots. The result was the loss of about 100,000 residents of the "Colonia Centro", leaving the area almost deserted at night.
By the 1980s, so much had fled the Centro that many of its former mansions were either abandoned or turned into tenements for the poor, and its sidewalks and streets taken over by pickpockets and milling vendors. For many people, especially international visitors, Mexico City's reputation for pollution, traffic and crime has made the city someplace "get into and out of as fast as you can," seeing it as little more than an airport through which to make their connecting flights to the more attractive resort areas. Until recently, many of the restaurants of the area, even the best, would close early to allow employees time to get home because the area was not particularly safe at night.
Since then the government has made efforts to revitalize this part of the city. Starting in the early 2000s, it infused 500 million pesos (US$55 million) into the Historic Center Trust and entered into a partnership with a business group led by Carlos Slim, to buy dozens of centuries-old buildings and other real estate to rehabilitate. Work began with renovating 34 blocks west of the Zócalo, digging up the antiquated drainage system and improving water supply. An architect was put in charge of each of the thirteen main streets to restore the facades of more than 500 buildings. The latest infrastructure projects of this type have been centered on the southeast portions of the area, on República de El Salvador, Talavera, Correo Mayor, Mesones and Pino Suárez streets, mostly focusing on repaving streets and updating the very old drainage system of the area. In the process, the construction is unearthing artifacts from the pre-Hispanic period to the present day.
All over the historic center, streets have been pedestrianized, buildings have been remodeled and restored, and new museums opened. In the 1990s, after many years of controversy, protests and even riots, most street vendors were evicted to other parts of the city. The impetus to bring things back to the city center included the construction of the new mayoral residence just off the Zócalo. The government has buried electric and telephone cables in the area, and replaced old asphalt with paving stones. It has also installed nearly 100 security cameras to help with crime issues. This paved the way for the opening of upscale eateries, bars and fashionable stores. Also, young people are moving into downtown lofts.

### The city's political position

From the days of the Aztecs, Mexico City has been the center of power for much of Mesoamerica and the Mexican nation. This centralism simply changed hands when the Spanish arrived, The Institutional Revolutionary Party (PRI), which came to power after the Mexican Revolution, again consolidated political power to the city, which benefited to the detriment of other parts of the country. The rapid expansion of Mexico City is related to the country's economic development in the period after World War II, the widening of the manufacturing sector, the success of the oil industry, and the country's proximity to U.S. markets. This growth allowed for the tolerance of PRI's authoritarianism. It still experienced economic growth up to the 1960s, but problems brought on by the one-party system were beginning to show. In 1968, Mexico City hosted the Summer Olympic Games. The event was meant to signal the prosperity of a developing nation, but serious problems had been masked by the PRI's authoritarian regime. Shortly before the inauguration of the Games, government troops massacred an unknown number of protesting students in Tlatelolco. However, the last straw may have been the 1985 Mexico City earthquake. On Thursday, 19 September 1985, at 7:19 am local time, Mexico City was struck by an earthquake of magnitude 8.1. on the Richter magnitude scale. The event caused between three and four billion USD in damage as 412 buildings collapsed and another 3,124 were seriously damaged in the city. While the number is in dispute, the most-often cited number of deaths is about 10,000 people.
While this earthquake was not as deadly or destructive as many similar events in Asia and other parts of Latin America it proved to be a disaster politically for the PRI. The government was paralyzed by its own bureaucracy and corruption, forcing ordinary citizens to not only create and direct their own rescue efforts but efforts to reconstruct much of the housing that was lost as well. This significantly affected politics in the years after the event. This discontent eventually led to Cuauhtémoc Cárdenas, a member of the Party of the Democratic Revolution, becoming the first elected mayor of Mexico City in 1997. Cárdenas promised a more democratic government, and his party claimed some victories against crime, pollution, and other major problems. He resigned in 1999 to run (unsuccessfully) for the presidency. Rosario Robles Berlanga, the first woman to hold the mayoral post, promised she would continue to reverse the city's decline.

### Recent discoveries

In May 2020, at least sixty Columbian mammoths (including male, female, and young mammoths) and 15 people were discovered by the National Institute of Anthropology and History headed by archaeologist Sánchez Nava under the Mexico City Santa-Lucia airport site named Zumpango, in the former Lake Xaltocan. According to the INAH, mammoth skeletons revealed in what used to be the shallow part of the lake were better anatomically preserved than those found in the deeper parts of the former lake. Mammoths probably got stuck in the lake and died.