Barañao began the Chilean War of Independence as a supporter of the patriots; after the royalists conquered the city of Concepción, Chile and many patriots fell to infighting, however, his views began to shift and he became a support of the royalists. Under the governorship of Mariano Osorio he took up the position of colonel of the hussars under king Ferdinand VII of Spain and became a famous soldier and swordsman within the Spanish army. His particular unit, a 150-strong squadron of hussars, served prominently at the royalist victory of Battle of Rancagua in 1814. After the defeat of the Battle of Chacabuco, however, like many other royalists he was forced to emigrate to Peru.
In 1814 Barañao married Josefa Valenzuela Santibáñez, daughter of Diego Valenzuela Avalos y Mercedes Santibáñez Careaga, with whom he had four children: Joaquín, Aniceto, José Manuel and Diego. Barañao returned to Chile with the change of government in the 1830s.