Perez always maintained a loyalty to the Spanish Monarchy, even during the New Spain War of Independence, which began in 1810. Therefore, when the war of independence broke out, the landowner joined the troops of Gen. Joaquín de Arredondo to fight against the independent troops. During the war, he occupied the position of captain of cavalry and participated in the battle of Medina. His participation in the war must have been important because he was appointed lieutenant colonel. In 1816 he was appointed interim governor of Texas, a position he held until 1817. During his administration, he fought the Comanches and freed several prisoners held by this people.