He did calligraphy work entrusted to him by an employee of the Virreunal Secretariat to provide for himself financially. Two years later, upon learning of the landing of the Expedición Libertadora (Liberation Expedition), he went to Pisco to join it, being one of the first patriots to do southern Within a year he was promoted to cavalry lieutenant.
He participated in the Proclamation of Independence and was stationed in Callao until the surrender of the realists.
Shortly thereafter, in 1822, he was ascended to the position of Captain and the following participated in the Zepita Battle. However, upon the advance of the realists, he quickly migrated to Trujillo, where he continued to contribute to public life.