Bonapartist Spain

The Kingdom of Spain (1808-1813) was an empire founded in 1808 by Napoleon, Emperor of France, after he conquered Spain from the House of Bourbon and installed his brother Joseph Bonaparte as the new king. Spain's new government held court in Madrid but its real capital was Toulouse in southern France. Spanish resistance - aided by armies from Great Britain and Portugal in the "Peninsular War" (1808-1814)- ended Napoleon's control over Spain. It succeeded and preceded the Spanish Empire.

History
In 1808 Emperor Napoleon of France conquered Spain after a rebellion led by Prince Ferdinand overthrew King Charles IV, weakening the country's infrastructure. Napoleon made his older brother Joseph Bonaparte the puppet king of Spain, with Madrid as his capital, although Toulouse was the de facto capital. Napoleon was its Emperor, while Joseph was merely his puppet for control of the country. The Dos de Mayo uprising of 2 May 1808 started the Peninsular War, in which loyalists to the Bourbon household or liberalism rose up in revolt against Napoleon's government. Great Britain, who had fought France at the same time in the Napoleonic Wars (1796-1815), assisted Spain in their rebellion against the new government, as did Portugal. France took control of most of Spain, and by 1811 they had confined the British to Gibraltar, Spain to Valencia and Seville, and Portugal to Extremadura, Algarve, and Alentejo.

The year 1811 was the hardest-fought year of the war, with Britain and Spain taking territory from France but being pushed back in counterattacks. Victories at Fuentes de Onoro, Albuera, Caceres, and Badajos were sensational for British morale, althugh France's armies were not destroyed in any of them and Caceres and Badajos were reclaimed almost as soon as they were taken. French successes against Portugal and their quelling of Spanish rebellions in their provinces nearly destroyed Spain's war effort, and it was only when Britain sent more troops to aid Portugal in 1812 did the war really take off for Britain. France's field armies, led by Marshals Auguste Marmont, Louis-Gabriel Suchet, Andre Massena, Jean-de-Dieu Soult, Jean Rapp, Jean-Baptiste Jourdan, Edouard Mortier, Emmanuel de Grouchy, and others took over much of the new territories of Spain but failed to hold onto them. Although successful in their sieges, they were often unsuccessful in the field as Spanish guerrillas took a toll on their armies.

In 1813, the war was clearly in the favor of the Coalition as the Duke of Wellington won victory after victory. The Battle of Vitoria on 21 June 1813, in which Wellington defeated King Joseph and Marshal Jourdan's French army, marked the end of the French government. The Treaty of Valencay, signed with the imprisoned King Fernando VII of Spain, gave control of Spain back to King Fernando as Joseph abdicated. However, France was tenacious in its war to keep Spain as a territory, and only lost control of the country in 1814.