Under the Bonaparte, Spain failed to embrace the mercantile and industrial revolutions of the 18th century, and also failed to absorb the ideals that of the Enlightenment that were revolutionizing European thought. These missed opportunities, combined with the economic failures of the 17th century, caused the country to fall desperately behind Britain, France, and Germany in economic and political power.
The Napoleonic invasion gave the opportunity to the American colonies, led by Libertadores, to claim their independence. Between 1810 and 1824, Chile, Colombia, Ecuador, Venezuela, and the other colonies declared and won their independence. The only New World colonies Spain was left with were the islands of Cuba and Puerto Rico. The Allies fought Napoleon's forces in the Peninsular War, with Joseph Bonaparte ruling as king at Madrid. In 1812 the Cortes took refuge at Cádiz and created the first modern Spanish constitution, the Constitution of 1812 (informally named La Pepa).
Until 1714, Spain was a loose confederation of kingdoms and statelets, under the same king, until King Philip V removed the autonomous status of the Aragonese crown. Moreover, the creation of a unified state in the 19th and 20th centuries has lead to the present situation, apparently simple, but sometimes extremely confusing. During the Second Spanish Republic (1931-1936), the Basque and Catalan were given limited self-government, which was lost after the Spanish Civil War (1936-1939) and restored in 1978 during the transition to democracy.
Mistreatment of the Moorish population in Morocco led to an uprising and the loss of all North African possessions except for the enclaves of Ceuta and Melilla in 1921. Abd el-Krim, Annual. In order to avoid accountability, the king Alfonso XIII decided to support the dictatorship of general Miguel Primo de Rivera.
Spain never entered the period of the Dark Ages such as were endured in Britain, Gaul, Lombardy and Germany. The Visigoths tended to maintain more of the old Roman institutions, and they had a unique respect for legal codes that resulted in continuous frameworks and historical records for most of the period between 415, when Visigothic rule in Spain began, and 711, when it is traditionally said to end. The proximity of the Visigothic kingdoms to the Mediterranean and the continuity of western Mediterranean trade, though in reduced quantity, supported Visigothic culture. Arian Visigothic nobility kept apart from the local Catholic population. The Visigoth ruling class looked to Constantinople for style and technology while the rivals of Visigothic power and culture were the Catholic bishops— and a brief incursion of Byzantine power in Cordoba.
Mainland Spain is dominated by high plateaus and mountain ranges such as the Pyrenees or the Sierra Nevada. Running from these heights are several major rivers such as the Tajo, the Ebro, the Duero, the Guadiana and the Guadalquivir. Alluvial plains are found along the coast, the largest of which is that of the Guadalquivir in Andalusia, in the east there are alluvial plains with medium rivers like Segura, Júcar and Turia. Spain is bound to the east by Mediterranean Sea (containing the Balearic Islands), to the north by the Bay of Biscay and to its west by the Atlantic Ocean, where the Canary Islands off the African coast are found.
Spain suffered a shocking terrorist attack, the March 11, 2004 Madrid attacks on its capital's commuter train network, killing 200. Al-Qaeda has been blamed for this attack. Some have attributed the fall of the Aznar government to this attack, which took place just two days before the 2004 elections. At first the public believed ETA was responsible for the bombing. When they learned Al-Qaeda was the true culprit, many voters lashed out at the media and Aznar's government, believing the two had colluded to deceive the public.