
Charles II (last Habsburg king of Spain) left his crowns to Philip of Anjou (first Bourbon king of Spain), grandson of Louis XIV (king of France, grandfather of Philip V) of France. Austria, Britain and the Dutch backed a rival Habsburg claimant, and the War of the Spanish Succession followed. Philip V kept Spain and America, but under the treaties of 1713–1714 Spain lost its lands in Italy and the Netherlands, and Britain kept Gibraltar and Minorca.
Catalonia, Valencia and Aragon had largely backed the Habsburg claimant. Barcelona fell on 11 September 1714, now Catalonia’s national day, and the Nueva Planta decrees abolished the separate laws and institutions of the Crown of Aragon. Spain was ruled more and more as one centralised kingdom from Madrid.

Charles III (reforming Bourbon king), king from 1759 to 1788, was the most reforming of the Bourbons. His ministers built roads and canals, opened up trade with America, expelled the Jesuits in 1767 and made Madrid a cleaner, grander capital, with the building that became the Prado Museum. Francisco de Goya (painter of the court and the war) became painter to the court of his son, Charles IV (king forced out by Napoleon).

In 1808 Napoleon (French emperor) forced Charles IV (king forced out by Napoleon) and his son Ferdinand VII (king who abolished the constitution) to give up the throne and made his own brother, Joseph Bonaparte (Napoleon’s brother, king of Spain), king. On 2 May the people of Madrid rose up, and the uprising spread across Spain. Spanish armies, guerrillas and a British and Portuguese army under Wellington (British general in Spain) fought the French until 1814. In besieged Cádiz, the Cortes wrote a constitution, proclaimed on 19 March 1812, that declared the sovereignty of the nation.

