As early as 1829, Peru fought against the Gran Colombia (a large loose state encompassing most of northern South America), of which the disputed lands were a part. After a series of battles, the war ended in what is known as the Battle of Tarqui (or "Portete de Tarqui"). The Gual-Larrea Treaty was signed on 22 September 1829 ending the war. This treaty, better known as the Treaty of Guayaquil, specified that the Gran Colombian-Peruvian border was to be the same border that had existed between the Spanish colonial viceroyalties of Nueva Granada and Lima.