 About the same time, the cabildo in Buenos Aires decided on the ouster of viceroy Sobremonte and his replacement by the second in command, Ruiz Huidobro.But by being captured, he lost his opportunity to become viceroy.With the beginning of the alliance between Britain and Spain during the , he was freed and returned to Spain.