After achieving its independence from Spain in 1818, Chile held control of territory spanning roughly the same boundaries of the colonial general captaincy that was under the control of the Spanish Empire's Viceroyalty of Peru. Under the "uti possidetis iuris" principle that delimited the international boundaries of the newly independent South American states, Chile bordered at its north with Bolivia in the Atacama Desert and at its east with Argentina. To the south, Chile claimed all lands west of the Andes and the entirety of Patagonia (principally for the Strait of Magellan), but in practice controlled only the area down to the Bío Bío River plus the area between Valdivia and Chiloé—the rest of the territory being either controlled by the independent Mapuche of Araucanía or sparsely populated by other indigenous tribes.