In 1828, in the aftermath of the wars of independence, the Republic of Peru and Gran Colombia, a confederation of the modern-day countries of Colombia, Ecuador, Panama, and Venezuela, went to war over disputed territories along their border: the Gran Colombia–Peru War. During the campaign for independence, there had been agreement that the new state lines should follow the old colonial boundaries. The ambiguities and changes during the colonial years, however, made this principle challenging to apply in practice. Early in 1828, Peru launched a campaign against Bolivia to take back the disputed territory and ultimately forced the Colombian military units stationed there out of Bolivia. Bolívar declared war on Peru in June; Peru responded in kind in July. Naval battles along the coast began shortly afterwards. Initially successful on land, the Peruvians were setback at the Battle of Tarqui in 1829. Following a military coup in Peru, the Convenio de Girón was signed, invoking the "status quo" based on the old, still disputed, colonial frontiers - almost guaranteeing future conflicts. The dissolution of Gran Colombia in 1830 complicated matters further, with Peru later arguing that the Convenio de Girón ceased to apply with the fragmentation of one of the signatories.