In 1836, Bolivia, under the rule of Marshal Andrés de Santa Cruz, invaded Peru to reinstall the deposed president, General Luis José de Orbegoso. Peru and Bolivia formed the Peru-Bolivian Confederation, with de Santa Cruz as the "Supreme Protector". Following tension between the Confederation and Chile, Chile declared war on 28 December 1836. Argentina separately declared war on the Confederation on 9 May 1837. The Peruvian-Bolivian forces achieved several major victories during the War of the Confederation: the defeat of the Argentine expedition and the defeat of the first Chilean expedition on the fields of Paucarpata near the city of Arequipa. The Chilean army and its Peruvian rebel allies surrendered unconditionally and signed the Paucarpata Treaty. The treaty stipulated that Chile would withdraw from Peru-Bolivia, Chile would return captured Confederate ships, economic relations would be normalized, and the Confederation would pay Peruvian debt to Chile. However, the Chilean government and public rejected the peace treaty. Chile organized a second attack on the Confederation and defeated it in the Battle of Yungay. After this defeat, Santa Cruz resigned and went to exile in Ecuador and then Paris, and the Peruvian-Bolivian Confederation was dissolved.