On 12 July 1821, after seizing partial control of Lima, San Martín was appointed Protector of Peru, and Peruvian independence was officially declared on 28 July. On 26 July 1822, after a closed-door meeting with fellow "" Simón Bolívar at Guayaquil, Ecuador, Bolívar took over the task of fully liberating Peru. San Martín unexpectedly left the country and resigned the command of his army, excluding himself from politics and the military, and moved to France in 1824. The details of that meeting would be a subject of debate by later historians.