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,
Peru the ensuing years, the country enjoyed relative economic and political stability, which ended shortly before the War of the Pacific with Chile. Throughout the 20th century, Peru endured armed territorial disputes, coups, social unrest, and internal conflicts, as well as periods of stability and economic upswing. Alberto Fujimori was elected to the presidency in 1990; his government was credited with economically stabilizing Peru and successfully ending the Shining Path insurgency, though he was widely accused of human rights violations and suppression of political dissent. Fujimori left the presidency in 2000 and was charged with human rights violations and imprisoned until