Barragán fought with Ejército Trigarante in the Mexican War of Independence, rising to the rank of brigadier general. After independence, he joined a conspiracy against Emperor Agustín de Iturbide with other ex-insurgents. They met in the house of Miguel Domínguez, ex-corregidor of Querétaro. The conspirators wrote to Pedro Celestino Negrete in Guadalajara, expecting support. Instead, he denounced the conspiracy to Iturbide. Seventeen people were arrested, including Guadalupe Victoria, Brigadier Nicolás Bravo and Barragán. Barragán was not freed until after the fall of the empire. On 20 June 1824, he was named commanding general of Veracruz, which was under bombardment from the Spanish in the fort of San Juan de Ulúa, the only position the Spanish still held in Mexico. Barragán blockaded the fort with two small ships. The Spanish garrison was suffering from hunger and illness. The Spanish commander, José María Coppinger, surrendered on 6 November 1825, under a pact of 14 articles. The pact was ratified on 18 November, and Barragán occupied Ulúa on that day. All of Mexico was now free of Spanish control. In recognition of the results, Congress named Barragán political chief of the state of Veracruz in 1828.
He was compromised in the 1827 :es:Plan de Montaño|Plan de Montaño, an armed uprising against President Guadalupe Victoria that aimed to prohibit secret Masonic lodge meetings of the Yorkinos and force the expulsion of Joel Roberts Poinsett, the diplomatic representative of the United States, who meddled in Mexican politics in the side of liberals. Colonel José Rincón, under Barragán's command in Veracruz, denounced the conspirators. Barragán was arrested at the hacienda of Santa Anna and confined in the jail formerly used by the Inquisition. Generals Guadalupe Victoria and Vicente Guerrero intervened on his behalf, and he was sentenced only to temporary exile. He lived in Ecuador, Guatemala and the United States. Called back to Mexico by Santa Anna, he was Minister of War from 20 November 1833 to 13 February 1834 in the governments of Santa Anna and Valentín Gómez Farías. During this period, Barragán and Quintanar were sent to suppress rebels in the state of Jalisco.
On 28 January 1835, Barragán replaced Santa Anna in the presidency on an interim basis. Legally, Santa Anna had to give up the presidency while he was acting as commander in chief of the armed forces. Barragán took measures to help widows and poor people, partly out of his own pocket. He also suppressed an anti-Santa Anna revolt in the current state of Guerrero. He served until 27 February 1836, when he resigned because of a grave illness. He died in the National Palace on 1 March 1836, a victim of a "putrid fever". He was interred in the Mexico City Metropolitan Cathedral, and his name was inscribed in letters of gold in the chamber where Congress met. José Justo Corro succeeded him in office.