sentences:  There were initial victories, such as in the Battle of Suipacha and the revolt of Cochabamba, but it was finally defeated during the Battle of Huaqui that returned Upper Peru to Royalist influence.Manuel Belgrano and José Rondeau would attempt other similarly ill-fated campaigns; the Royalists in the Upper Peru would be finally defeated by Sucre, whose military campaign came from the North supporting Simón Bolívar.The Spanish king Ferdinand VII was captured and imprisoned during the Peninsular War, and the Junta of Seville took over government, claiming to govern on the absent king's behalf.