The Spanish War of Independence: Napoleon, Cortes, and 1812
The Spanish War of Independence (1808-1814)
End of Carlos IV's Reign and French Influence
When the French Revolution broke out and Louis XVI was executed, Spain, like other European monarchies, initially declared war on revolutionary France. Spain later had to sign the Treaties of San Ildefonso in 1796 and 1800. These treaties made Spain and France allies against the British Empire. In 1805, the Anglo-Portuguese alliance was reinforced by the defeat of Spain and France in the naval Battle of Trafalgar.
Napoleon wanted to occupy Portugal. Manuel Godoy, Carlos IV's prime minister, signed the Treaty of Fontainebleau (1807) with France, which allowed French troops to cross Spain on their way to Portugal. French armies occupied several Spanish cities