During colonial times, the viceroyalty of Peru continued to lose land with the advance of the Portuguese, resulting in the treaties of Tordesillas and San lldefonso.
Esto llevó al tratado de Tordesillas y finalmente al de San Ildefonso.