 Royalist officers, split between liberals and conservatives, fought an internecine war among themselves.General Pedro Antonio Olañeta, commander in Upper Peru, rebelled against the liberal viceroy of Peru, José de la Serna, in 1823.This conflict provided an opportunity for the republican forces under the command of Bolívar and Antonio José de Sucre to advance, culminating in the Battle of Ayacucho on December 9, 1824.