He participated in the Peruvian War of Independence. In 1851, Echenique won the presidential elections to succeed Ramón Castilla. Under his government, the first civil laws of Peru were promulgated, and slavery was abolished. The finalizing phase of the construction of the Tacna-Arica railroad was also completed.