In 1795 the peace of Basilea freed the young lieutenant from his parole. In the following year his father died, and the treaty of San Ildefonso brought Spain as an ally of the French republic into collision with Great Britain. On the 14th February, 1797, the “Murcia,” on board the Spanish Mediterranean squadron, took part in the disastrous affair off Cape Saint Vincent. On the 15th August, 1798, San Martin was marine officer on the Santa Dorotea, when that ship was captured after a desperate defence, by the English 64-gun ship Lion, and being thus for the second time debarred from active service, he devoted his leisure to the study of mathematics and drawing.
In the year 1800 at the head of a company of his old regiment, he took part in the serio-comic war with Portugal known as the “War of the Oranges,” and was present at the siege of Olivenza. After the Peace of Amiens in 1802, his regiment was employed in the blockade of Gibraltar and Ceuta, and in 1804 we find him in garrison at Cadiz, as second captain of a light infantry regiment, where his conduct during a pestilence was as honourable to him as had been his conduct in the field.
By the Treaty of Fontainebleau, in 1807, France and Spain divided Portugal and her colonies between them, and a column of 6,000 Spanish troops under Solano invaded Portugal. The regiment to which San Martin was attached, captured the town of Yelves, but took no further part in the campaign.
The émeute of the 2nd May at Madrid, gave the signal for an outbreak of popular indignation, against the usurpations of Napoleon. The news reached the army of Solano when on the march for Cadiz. Solano was at first undecided what course to adopt, but his appointment as Captain-General of Andalucia and Governor of Cadiz being confirmed by the French, he on the 28th May issued a proclamation condemning the insurrection. The people flocked in crowds to the palace, shouting for an immediate attack upon the French squadron lying in the harbour; in the confusion some shots were fired. San Martin, who was officer of the guard, withdrew his troops into the house and closed the door. It was blown in by a cannon-shot, but time had been gained for the escape of Solano across the roof to a neighbouring house, where, however, he was soon afterwards found and cruelly butchered.
This tragedy was never effaced from the memory of San Martin, and without doubt greatly affected his policy on many subsequent occasions. In spite of his love of liberty he ever after looked with horror upon mobs, and upon governments who relied upon them. He considered that intelligence supported by orderly strength should hold the government of the world. Nevertheless his reason and his heart must have told him that the cause of Spain was just, and that the executions on the Prado of Madrid on the 2nd May were more barbarous and less justifiable than was the murder of Solano.
About this time it is said that Miranda visited Cadiz in disguise, but for this report we can find no foundation. He was the founder and organiser of the secret societies to which South Americans throughout Europe were already affiliated, but Spain was the last country in Europe in which such societies were established. Cadiz being the one port open to American trade, became naturally at this time the centre of the revolutionary propaganda.
In the early years of the nineteenth century an association styled “Sociedad de Lautaro,” or “Caballeros Racionales,” had ramifications all over Spain, and was affiliated with the “Gran Reunion Americana” established in London by Miranda. This society had in Cadiz alone in the year 1808 more than forty members, some of them grandees of Spain. Those of the first grade were pledged to work for the independence of America; those of the second swore “to recognise no government in America as legitimate unless it was elected by the free and spontaneous will of the people, and to work for the foundation of the republican system.” Of this society San Martin became a member. An American by birth, a revolutionist by instinct, and a republican by conviction, he was, perchance, without knowing it, an adept of Miranda, and was destined to make the dream of the master a reality, when the bones of that master lay rotting on the mud banks upon which his eye might at this time often rest.
At the same time with San Martin three other members joined the lodge; Alvear, who was his confidant till he became jealous of his fame; José Miguel Carrera, who was to die cursing him; and, most modest of all, the naval lieutenant Matias Zapiola, who was afterwards his right arm on many a hard-fought field. San Martin was the least brilliant and the poorest of them all; his comrades recognised the superiority of his talents as a soldier, and said that he did the thinking for them all, but in the great revolutionary drama that all foresaw they assigned to him only the place of a stern warrior; Alvear and Carrera, the most arrogant and the most ambitious, were to be the heroes.
The general rising in Spain found San Martin in his place as an officer of light infantry under the command of Colonel Menacho. He was soon promoted, and his regiment joined the second division of the army of Andalucia, commanded by the Marquis of Coupigni. When the French under Dupont crossed the Sierra Morena, he was placed in charge of the line of the Guadalquivir. On the 28th June, 1808, he led a mixed column against the advanced guard of the enemy, and charged a detachment of cavalry with such impetuosity at the head of twenty-one hussars, that he killed seventeen of the enemy, took four prisoners and all their horses, and retired in triumph, in the face of very superior numbers. This action was greatly applauded by the whole army, a badge of honour was given to all who charged with him, and he was appointed captain in the Bourbon regiment “on account of distinguished conduct in the action at Argonilla.”
This small triumph was the precursor of one of the greatest victories of the epoch. Before one month had elapsed, the imperial eagles of Napoleon were beaten by an army of recruits inspired by patriotism, and Captain San Martin was mentioned with distinction in the order of the day of the battle of Baylen.