During the War of the Pacific between Chile and Peru, he was appointed commander of the strongest unit of the Peruvian Navy, the armoured frigate "Independencia". As such, he participated in the Battle of Punta Gruesa on 21 May 1879, when his ship crashed with a submarine rock while pursuing the Chilean schooner "Covadonga," commanded by Captain Carlos Condell. He was rescued from his sinking ship, imprisoned in Arica and court martialled by his own comrades. He was dismissed from the navy and forbidden to ever wear his uniform again. He decided to continue the war as a simple civilian, in order to regain his lost honor. On 27 February 1880, during the Sea Battle of Arica, while in command of the Manco Capac, he successfully disabled the captured Huascar killing her commander Captain Manuel Thomson. During the siege of Arica, he was in charge of the batteries of the Cape, where he was killed during the Battle of Arica.