During that time he fought among Spanish forces under siege by Moors, in a naval battle against the British navy and in the Peninsular War.
An officer in the military, Juan de San Martín requested a new deployment, and in 1781, he moved his family from Yapeyu to Buenos Aires.
[5] By this time, San Martín was second to Francisco María Solano Ortiz de Rosas, governor of Andalucía and a close friend.
Solano, influenced as well by the enlightenment ideas, had doubts about using his army to back the Dos de Mayo Uprising, even when requested by the Junta of Seville.
Cádiz was by then a very active city, with discussions about Jovellanos, Flórez Estrada, the French and British democratic advances, popular intervention in politics, the role of the Juntas and the military leaders.
In June 1808, he joined a force combining regiments and militias, organized by Juan de la Cruz Mourgeón, thus learning further ways to wage war beyond the classic military discipline.
In the battle, a French officer nearly killed him with his sword, but he was saved by Sargeant Juan de Dios, who died in the effort.
This victory gave new hopes to the Spanish front, forcing Joseph Bonaparte to leave Madrid and allowing later the liberation of Andalucía.
Despite the Spanish victory at the Battle of Albuera, where San Martín fought next to William Carr Beresford, France prevailed and conquered most of the Iberian Peninsula, with the exception of Cádiz.
The reasons that San Martín left Spain in 1811 to join the Spanish American wars of independence as a patriot remain contentious among historians.
Bartolomé Mitre, one of the earliest historians of San Martín, wrote that "the American criollo had paid with usury his debt to the mother country, joining her during her conflicting days, and could consequently separate himself from her without deserting during an hour of need, leaving her protected by the powerful aegis of Great Britain that guaranteed the definitive triumph under the command of the future victor of Waterloo.
Then, he turned his eyes to South America, whose independence he had presaged [...] and decided to return to his distant nation, which he had always loved as a true mother, to offer her his sword and devote her his life".
Those groups shared a common perspective about the revolutions and rebellions that took place in the Americas between 1809 and 1811: they considered that they were, from this early stage, separatist wars, intending to create new countries apart from Spain.
Under this logic, those historians consider that San Martín's move to the Americas to continue a fight about to be lost in Spain would make complete sense.
[15] José de San Martín moved to Buenos Aires in the George Canning ship, with other American born generals like Carlos María de Alvear or José Matías Zapiola, but also with Spanish born generals like Francisco Chilavert and Eduardo Kailitz, for whom the "telluric forces" would bear absolutely no value.
[17] Similarly, his resignation as head of the Army of the Andes says "...I had the first news of the general movement at both Americas and that their original purpose was to emancipate themselves from the Peninsular Tyranic Government.
[18] An 1848 letter to the president of Perú Ramón Castilla says "In a meeting of Americans in Cádiz, knowing about the first steps taken in Caracas, Buenos Aires, etc; we decided to return each one to our native countries, to offer them our services in the struggle that we calculated would be waged soon".
Such a conflict may be a possible absolutist restoration, which took place when Ferdinand VII returned to the throne, but could also happen if the Regency Council prevailed over the Junta of Seville.
[20] This perspective, however, fails to give an explanation for the hostility between San Martín and the anglophile Bernardino Rivadavia, or his support to Juan Manuel de Rosas during his conflicts with Britain.
[21] Patricia Pasquali pointed similar causes but arriving to a different conclusion: San Martín may have moved to South America in order to get higher military promotions, which would be more difficult to get at the Peninsular War.