The Royal and Pontifical University of Mexico (Spanish: Real y Pontificia Universidad de México) was a university founded on 21 September 1551 by Royal Decree signed by Charles I of Spain, in Valladolid, Spain. It is generally considered one of the first universities founded in North America and second in the Americas (preceded by the National University of San Marcos in Lima, Peru, chartered on May 12 of the same year, and the Universidad Michoacana de San Nicolás de Hidalgo, formerly known as the Royal College of Saint Nicholas, established in 1540. After the Mexican War of Independence it was renamed the University of Mexico.
When Mexican liberals were in power at intervals in the nineteenth century, it was closed, since liberals sought to put education in the hands of the state rather than the Roman Catholic Church. Its first closure was in 1833, when Valentín Gómez Farías implemented liberal policies. When Antonio López de Santa Anna returned to power, the university was reopened. It was finally abolished in 1865 during the Second Mexican Empire by Maximilian I of Mexico. Scattered institutions, including secularized successors of its faculties of law and medicine, other secular colleges founded by liberals on the model of the French grandes ecoles, and religious establishments outside Mexico City, continued without interruption.