On 1st January 1820, by the orders of King Ferdinand VII of Spain, the Overseas Army (Ejército de Ultramar) led by Félix Calleja, count of Calderón, and Enrique José O'Donnell, count of La Bisabal, set sail in Punta Umbría, in Huelva, Andalucía, for the overseas Spanish domains, by that time rebelled against the monarchy.
By 13th June, Calleja and O'Donnell, arrived La Paloma, in the Cisplatina province of the United Kingdom of Portugal, Brazil and the Algarves. Both, commanding a 20.000 men army, took the city and dispersed their troops to take the rest of the province's ports. In a few days, they were besieging Maldonado.
That port was conquered by 27th June. From there, Calleja led some raids to the province's mainland. During a skirmish, he crossed the Uruguay river, and managed to attack an independentist base of the area. The warlord of such base was Francisco Ramírez, Supreme Chief of the Republic of Entre Ríos.
The attack left the Entre Riano troops weak and the warlord was surprised, as he didn't expect the Spaniard presence on the continent. On 4th July, he had to retreat from the river, as he was menaced by both the Spaniard and the federalist armies of José Gervasio Artigas.
Artigoas strengthened his position in the Uruguay and Paraná rivers, and joined his ally Estanislao López, warlord of Santa Fe. Artigas and Lópex achieved to defeat Juan Bautista Bustos, the general sent by the central government, the Directory, to suppress them. Bustos was forced to hold back to the borders of Buenos Aires.
Ramírez, fearing another attack from Artigas, sent a messenger to the directorial general of Santa Fe, Juan Ramón Balcarce. Balcarce was not interested in allying with a federalist rebel such as Ramírez until he found out that Spanish troops were invading the Banda Oriental (Eastern Bank, OTL Uruguay). He informed the Supreme Director, Juan Martín de Pueyrredón, of the situation. The Director, after an investigation of his privateers, confirmed the information. By then, reinforcements were arriving to the Spanish bases, and the coasts were well protected.
Feeling the menace of a new conquest by the Spaniards, Pueyrredón ordered Balcarce to reach a truce with Ramírez and ally against the coming enemy (that included Artigas and the federals), and sent both Bustos and baron Eduardo Kaunitz of Holmberg to defend his position. Holmberg accepted under the condition that his salaries were given to the then sick Manuel Belgrano, who was in Buenos Aires. Pueyrredón accepted and managed tog et a good doctor for Belgrano to gain the support of many troops that had fought in his armies in the north.
By 6th August, O'Donnel was besieging Montevideo. Carlos Federico Lecor, viscount of La Laguna, Fructuoso Rivera and Juan Antonio Lavalleja were the main defender of the Portuguese possessions that were left in the Banda Oriental.
While this was happening on the east, José de San Martín was departing to Peru. On 20th August he set sail from Valparaíso.
Since 9th August, the second section of the Overseas Army, led by Rafael del Riego and Antonio Quiroga, was stationed in Peru with 12.000 men.
On 8th September, San Martín landed on Paracas, and started his attacks on the Spaniards, with support of Chilean and Rio Platense troops. When the Peruvian rebellions began, Riego ordered Quiroa to resist in San Bartolomé de Huacho to defend the region of Lima from the San Martinian army, commanded by Juan Antonio Álvarez de Arenales. In Lima, Riego rebelled against viceroy Joaquín de la Pezuela.
The royalists (lealists) demanded him name the conservative José de La Serna as new viceroy, but Riego ignored his officers and decided to proclaim, before his army and all the people of Lima, the restoration of the Constitution of 1812 sanctioned in Cádiz, popularly known as La Pepa. De La Serna accused Riego of rebelling against the Crown and prepared to make a coup with his officers, but he was stopped by the Peruvian general Juan Pío de Tristán, who declared himself a follower of the constitution. Tristrán had contacts with the revolutionary groups of the Río de la Plata, and with San Martín himself.
The patriots and royalists continued fighting until 15th January 1821, when Riego asked to meet San Martín to discuss a truce.
Registers published several years after, especially those written by Tristán, affirm that Riego said:
"I know I am a rebel. I have betrayed my King and my general; but my people, the Spanish people, which you and your countrymen are part of, are demanding me, as is God, to enforce this Constitution, as without such, Spain and its people will be left only shame and damnation. I require you, General, to join me, to free our Peoples from the oppression of tyrants. I cannot achieve this without your people's help."
On 18th January, San Martín wrote to Pueyrredón:
"I am pleased to announce to you, my dear friend, that General Rafael del Riego has returned the control of Peru to its inhabitants. Still, in nations that are brothers of our own, people still suffer the oppression of the same tyrants we once suffered. General Riego pretends to liberate Spain from the tyranny of King Ferdinand VII, and I support him. Together, we can create a fatherland to all Spaniards, creoles and Indians, in which there will be no slaves nor servants. From today we begin the liberation of the lst remnant of the Spanish Empire."
By 12th February, Riego and San Martín were marching northwards to meet the army of Simón Bolívar. Bolívar wanted to occupy by force the Free Province of Guayaquil, so rpesident José Joaquín de Olmedo asked the Andes Army for protection.
After the battle of Carabobo in 24th June, Olmedo, Riego and San Martín met Bolívar and Antonio José de Sucre. Bolívar refused to return the lands he liberated to the Spanish empire, but he agreed of creating a mutual border to avoid future disputes towards the frontier between Spanish Americas and Colombia.
After this, the Andes Army dedicated to destroy the last royalist forces in Upper Peru (OTL Bolivia and the Atcama desert). On 7th May 1822, San Martín occupied Chuquisca an prepared for invading Río de la Plata and stop the civil war.
By this time, Calleja and O'Donnell had occupied the whole Banda Oriental, except for the still resisting Montevideo. When the province was about to fall to the Overseas Army, Artigas and the guarani warlord of Misiones Andrés Guazurarí and Estanislao López broke the siege of Montevideo in 31st July. Then they signed a truce with the Brazilian/Portuguese armies, deciding to first get rid of the Spaniards and then decide whether if Brazil/Portugal or the Río de la Plata kept the Cisplatina.
Regent prince Peter of Braganza had sent generals to help in the battle against the spanish, such as Bento Gonçalves da Silva or Antônio de Sousa Neto and David José Martins Canabarro, or others like Joaquís Javier Curado. All of them were Brazilian-born, not Portuguese.
Peter, unhappy with the return of this father to Lisbon, did not wasnlt to leave Brazil nor make the Brazilians lose their privileges, so he started a revolution aiming to proclaim independence.
In September 1822, the last royalists armies invaded Paraguay escaping from Upper Peru. Dr. Gaspar Rodríguez de Francia asked for help from Riego and San Martín to defeat the royalists, but they finally captured the whole country and forced Paraguay to accept the Constitution as well.
In December, a federalist party of Buenos Aires led by Manuel Dorrego and Miguel Estanislao Soler menaced Pueyrredón with a coup if he didn't join the federalist league of Artigas.
Be cause of the conflict in the Littoral, the Congress of Tucumán became a stalemate. General Juan Galo Lavalle, under the orders of San Martín, took Tucumán and got the deputies signing a document stating that <<These Provinces accept to reign in them the Politic Constitution of the Spanish Monarchy>>. Other generals, such as Gregorio Aráoz de la Madrid, Bustos, José María Paz and Pueyrredón himself joined the constitutionalists and suppressed federalist, independentist and republican insurrections in the several provinces.
Others, like Eusebio Gregorio Ruzo of Catamarca and Facundo Quiroga in La Rioja deemed the Constitution too centralist and joined Artigas' league. Ramírez decided that, after the overthrowing of Pueyrredón, he didn't have a reason to be his ally anymore, and joined Artigas as well.
To solve the conflict, San Martín asked help form Martín Miguel de Güemes and Manuel Belgrano (who survived his illness thanks to Holmberg's funds) to Eustaquio Méndez. They were both federals and negotiated with Artigas. A final treaty was signed between Pueyrredón for the centralist/constitutionalist side and Ricardo López Jordán for the federalist/patriot side. Artigas accepted the Constitution if it was reformed.
Several of the new allied leaders of the patriot/constitutionalist league attacked the Banda Oriental. William Brown, David Jewet and Hippolyte de Bouchard raided the coasts, while Manuel Oribe, Rivera and Lecor attacked by land. On 3th May 1824, in the battle of Punta del Diablo, Calleja and O'Donnel were defeated by the armies of Lamadrid, Riego and the Brazilian David Canabarro.
Portuguese and Spanish (Iberians both) had joined to attack the constitutionalist movements of Brazil and the Spanish Americas in Patagonia and Malvinas Island (OTL Falkland Island).
By mediation of Carlos María de Alvear, Peter of Braganza agreed to meet with the cosntitutionalist to prepare a joint invasion on the Iberian Peninsula. He got surprised when, during the meeting in Rio de Janeiro, San Martín proposed Peter as new monarch to replace both Ferdinand VII and John VI and create a new constitutional Iberian union.
Already in 1823 constitutionalist rebellions began on peninsula soil, by initiatives of generals such as Evaristo Pérez de Castro, Eusebio Bardají Azara, Francisco Martínez de la Rosa and others. At the time the knew about the alliance between Riego, San Martín and Peter of Braganza, they were already besieging Madrid and taking Ferdinand VII prisoner.
Other military leaders rebelled in Lisbon. On 3th July 1824, John VI abdicated to his son Peter, pressed by General António Severim de Noronha.
On 15th July, Peter and his armies arrives the coasts of Setúbal, and sent a letter to the liberals of Lisbon to avoid any harm to his father:
"I, Don Peter IV, King of Brazil, Portugal and the Algarves, accept the throne of the Fatherland and the abdication made by my excellent father. I notice all those in Lisbon that I have disembarked in Setúbal and head towards the city. On my arrival, I expect to be received peacefully. This is an order of your King, Don Peter."
He arrived on 17th July, followed by Riego, San Martín and Artigas. The next day, he organized an Assembly of Notables, formed by the main rebel generals, and swore before them and his father as King. A day after, John VI set sail for Rio de Janeiro, where he would stay for two years, until the new Constitution was sanctioned.
8th August, Peter reached Cádiz an organised a new Assembly to swear as King of Spain.
By the time, Ferdinand VII had fled and exiled in Versailles under the protection of the Bourbon kings of France. His brother, Carlos María Isidoro de Borbón, started a guerrilla movement to restore the absolute monarchy. He stated himself was the new king <<be cause of the obvious abdication made by my brother by departing the nation to France>>. Many nobles and conservatives did not support Carlos because they still thought Ferdinand was the true king, and Carlos was an usurper.
On 15th September a Constitutional Convention met in Cádiz. It gathered representatives from all the provinces, though not all its members were able to attend until 2nd December.
Finally, on 6th March 1825, Peter sanctioned the Political Constitution of the Spanish Monarchy (including Portugal and colonies) with the following preamble:
"I, Peter II, Catholic King of the Spains, supreme lord and protector of the Fatherland, swear this Constitutional Law, to reign in my domains and subjects in Both Hemispheres; under the watch of God, Father, Son and Holy Spirit, One in the Holy Trinity, Author and Supreme Legislator of the Universe; and the representatives of our Nation."