Peru was heavily indebted, and political in-fighting was again on the rise. Peru embarked on a railroad-building program that helped but also bankrupted the country. In 1879, Peru entered the War of the Pacific which lasted until 1884. Bolivia invoked its alliance with Peru against Chile. The Peruvian Government tried to mediate the dispute by sending a diplomatic team to negotiate with the Chilean government, but the committee concluded that war was inevitable. Chile declared war on 5 April 1879. Almost five years of war ended with the loss of the department of Tarapacá and the provinces of Tacna and Arica,
Third Upper Peru campaign would spread rumors in Europe that the May Revolution was over. Third Upper Peru campaign Third Alto Perú campaign (1815): The Northern Army, unofficially commanded by José Rondeau, started another campaign, but this time without the authorization of Supreme Director Álvarez Thomas. With the lack of official support, the army faced anarchy and later would lose the aid of the Provincial Army of Salta, commanded by Martín Miguel de Güemes. After being defeated in the battles of Venta y Media (October 21) and Sipe-Sipe (November 28), the northern territories were lost. They were reannexed by the Spanish Viceroyalty of Peru,