ther Joseph in 1808 precipitated the drive by the colony for independence from Spain. A national junta in the name of Ferdinand – heir to the deposed king – was formed on 18 September 1810. The Government Junta of Chile proclaimed Chile an autonomous republic within the Spanish monarchy (in memory of this day Chile celebrates its National Day on 18 September each year). After these events, a movement for total independence, under the command of José Miguel Carrera (one of the most renowned patriots) and his two brothers Juan José and Luis Carrera, soon gained a wider following. Spanish attempts to re-impose arbitrary rule during what was called the Reconquista led to a prolonged struggle, including infighting from Bernardo O'Higgins, who challenged Carrera's leadership.
Intermittent warfare continued until 1817. With Carrera in prison in Argentina, O'Higgins and anti-Carrera cohort José de San Martín, hero of the Argentine War of Independence, led an army that crossed the Andes into Chile and defeated the royalists. On 12 February 1818, Chile was proclaimed an independent republic. The political revolt brought little social change, however, and 19th century Chilean society preserved the essence of the stratified colonial social structure, which was greatly influenced by family politics and the Roman Catholic Church. A strong presidency eventually emerged, but wealthy landowners remained powerful.
Toward the end of the 19th century, the government in Santiago consolidated its position in the south by suppressing the Mapuche independence during the Occupation of Araucanía. A treaty with Argentina confirming Chilean sovereignty over the Strait of Magellan was signed in 1881. As a result of the War of the Pacific with Peru and Bolivia (1879–83), Chile expanded its territory northward by almost one-third, eliminating Bolivia's access to the Pacific, and acquired valuable nitrate deposits, the exploitation of which led to an era of national