 During the Spanish War of Independence, he was a deputy in Galicia's government junta.When the Supreme Junta was formed in Seville, learned of Sobremonte's ouster, they named Ruiz Huidobro as his replacement as Viceroy of the Rio de la Plata, but when he arrived, he learned that the cabildo had named Liniers, who refused to cede command to him.As his naming to the post was not much more official that the one of Liniers, he accepted the post of Inspector of Arms of the Viceroyalty.