After the Battle of Ayacucho, 9 December 1824, that sealed the independence of Peru and South America, Spain made futile attempts to retain its former colonies, such as at the Siege of Callao (1826). On 20 August 1836, during the Peru-Bolivian Confederacy, President Andrés de Santa Cruz mandated the creation of the Callao Littoral Province ("Provincia Litoral del Callao"), which had political autonomy in its internal affairs. During the government of President Ramón Castilla, Callao was given the name of Constitutional Province ("Provincia Constitucional"), on 22 April 1857; before that, Callao had the name of Littoral Province. All of the other Peruvian provinces had been given their names by law, while Callao was given it by constitutional mandate.