He fought in the and the battle of "“la Plata”," where he was arrested by Spanish troops. He was court-martialed as a prisoner of war, found guilty of treason, and sentenced to death. His life was spared thanks to the influence of his father-in-law, his wife Juana Jurado y Bertendona, and some monetary payments to the Spanish authorities. He was freed under probation and vanished from the war theatre until the revolutionary triumph at the Battle of Boyacá (Puente de Boyacá) on August 7, 1819.