quality:correction, structural:expansion, linguistic:voice_change
Last days

Chile and Iglesias's government signed the Peace Treaty of Ancón on 20 October 1883, which ended the war and ceded Tarapacá to Chile.

Lizardo Montero tried to resist in Arequipa with a force of 4,000 men, but when Chile's 3,000 fighters arrived from Mollendo, Moquegua, and Ayacucho and began the assault to Arequipa, the Peruvian troops mutinied against Montero and allowed the Chileans to occupy the city on 29 October 1883. Montero opted for a Bolivian asylum. The occupation of Ayacucho by Chilean Colonel Urriola on 1 October lasted only 40 days, as Urriola withdrew to Lima. Ayacucho was occupied by Cáceres's new army of 500 men. Caceres continued to refuse the cession of territories to Chile.

The basis of Cáceres's war the increasingly powerful Indian insurrection against the Chileans, which had changed the nature of the war. Indian guerrillas fought "white men from all parties," looted towns, and seized land of the white owners. In June 1884, Cáceres accepted Treaty of Ancón "as an accomplished fact" but continued to fight Iglesias.

On Cáceres's true reasons for his change of mind, Florencia Mallon wrote:

On 29 October 1883, the Chilean occupation of Lima ended, and on 4 August 1884, Lynch and the rest of the Chilean Expeditionary Forces embarked in Callao for Chile.