In September 1865, he was studying law at the University of Chile, when war with Spain began, and he enlisted in the navy, participating in the engagement of Abtao, 7 February 1866. In the same year he founded the literary magazine "La República Literaria", at the head of which he remained while he was in Chili. He was appointed in 1867 secretary of the legation in Bolivia, was graduated in law in 1868, and traveled through Europe and the United States.