On January 1, 1846, the Criollo leaders in Merida declared independence as the Republic of the Yucatán for the third time. In 1847, the Caste War broke out when the Mayas rebelled against the Criollo upper class that controlled the Yucatán Republic. They drove most of the Criollos out of the Peninsula except for the those behind the walls surrounding Mérida and Campeche City.
With their back to the wall, the Yucatan Republic offered sovereignty over to Yucatán to either USA or Britain or Spain, whichever was first to effectively end the Maya revolt. In a desperate effort to put down the rebellion, the Yucatán Criollos agreed on 17 August 1848 to re-unite with Mexico if the Mexican army would put down the Maya rebellion. With fresh Mexican troops, they retook control over northwestern portion of the Peninsula. However, Mayas maintained control of the southeast for the rest of the 19th century and beyond. Skirmishes continued on and off for more than 70 years. Maya independent control of some parts of the southeastern Yucatán Peninsula did not end until after the Mexican Revolution.