Anglo-Spanish War (1796–1808)

The Anglo-Spanish War was fought between 1796 and 1802, and again from 1804 to 1808, as part of the Coalition Wars. The war ended when an unexpected alliance was formed between both countries when the alliance was signed between Great Britain and the Spanish Bourbon dynasty, when Napoleonic France invaded Spain in the French invasion. The Anglo-Spanish alliance eventually ended in military victory against Napoleonic France, instrumental in ending Napoleon's reign and dominance over Europe.

Background
In the War of the First Coalition, Spain declared war on the newly formed French Republic, and joined the Coalition in attempting to restore the Bourbon Monarchy. The main Spanish general was Antonio Ricardos, who failed to secure a decisive victory, despite initial successes. French forces elsewhere quickly overran the Austrian Netherlands after the Battle of Fleurus, and the Dutch Republic collapsed under huge pressure. The Spanish were having similarly bad times. The Spanish navy did little, with the exception of combining with the British and participating in the Siege of Toulon.

Following the Battle of the Black Mountain, the French Republican forces gained a huge advantage, and by 1795, the Peace of Basel was signed, forcing Spain and the Prussia to exit the Coalition. In 1796, encouraged by massive French gains in the Rhine campaign and the Italian campaign, Spanish prime minister Manuel Godoy signed the Second Treaty of San Ildefonso, establishing a Franco-Spanish alliance and common war against Great Britain. The hope was that victorious France would also win over land and money for Spain, particularly against Spain's then main naval threat, Britain. The alliance continued the longstanding cooperation between France and Spain established by the Pacte de Famille in 1733, broken only by the French Revolution.

1796–1802
The war was damaging for Spain and for the Spanish Crown's revenues, with the British blockade greatly reducing the amount of wealth arriving from the colonies. A main Spanish fleet, under José de Córdoba y Ramos, had 27 ships of the line, however, and planned to link with the French and protect coveys of valuable goods. The British Mediterranean fleet had 15 ships of the line—heavily outnumbered by Franco-Spanish threats, forcing a retreat from Corsica and Elba by 1797. However, the Spanish Navy proved incapable of coordinating with its French Republican allies, and was heavily defeated at the Battle of Cape St. Vincent. This left Spain in a disadvantaged position at sea for the rest of the war, even if they repulsed two British assaults on Cádiz and Tenerife and a later British expedition to Ferrol.

The war extended to the Pacific, where in early 1797 the Spanish captured a number of British merchantmen and whaling ships.

Also in 1797, the British East India Company (EIC) at Calcutta chartered a number of East Indiamen and local vessels to serve as transports for a planned attack on Manila. However, the Government cancelled the invasion following a peace treaty with Spain and the EIC released the vessels it had engaged.

1804–1808
The Treaty of Amiens in 1802 provided for a temporary truce in hostilities, only to be broken in 1804 when, by surprise and without declaration of war, British ships attacked a Spanish squadron of frigates that was carrying gold and silver bullion to Cádiz. Spanish frigate Nuestra Señora de las Mercedes blew up and the British captured the rest.

The French planned an invasion of Britain in the coming year; the Spanish fleet was to be an integral part in assisting this invasion. At the Battle of Trafalgar, in 1805, a combined Franco-Spanish fleet, attempting to join forces with the French fleets in the north for the invasion, were attacked by a British fleet and lost in a decisive engagement. The British victory ended the immediate threat of an invasion of Britain by Napoleon. It also seriously shook the resolve of the unpopular Godoy-led Spanish government, which began to doubt the utility of its uncertain alliance with Napoleon. Meanwhile, a British campaign (1806–1807) to conquer the strategically important Río de la Plata region in Spanish South America met with failure.

Godoy withdrew from the Continental System that Napoleon had devised to combat Britain, only to join it again in 1807, after Napoleon had defeated the Prussians. Napoleon, however, had lost his faith in Godoy and Spanish King Charles IV. There was also growing support in Spain for the king's son, Ferdinand, who opposed the widely despised Godoy. Ferdinand, however, favoured an alliance with Britain, and Napoleon had always doubted the trustworthiness of any Bourbon royalty.

Aftermath
In 1807, France and Spain invaded Portugal, and, on 1 December, Lisbon was captured with no military opposition. In the beginning of 1808, the French presence in Spain was so dominating that it led to revolt. Napoleon then removed King Charles and his son Ferdinand to Bayonne and forced them both to abdicate on 5 May, giving the throne to his brother Joseph. This led to the Peninsular War and the de facto end of the Anglo-Spanish War, as George Canning, foreign secretary of His Majesty's Government, declared:
 * "No longer remember that war has existed between Spain and Great Britain. Every nation which resists the exorbitant power of France becomes immediately, and whatever may have been its previous relations with us, the natural ally of Great Britain."

With this, the Bourbon government of Spain, along with any Juntas claiming to represent it, became allies of Britain, as the Peninsular War developed and ended in victory for both Britain and Spain.