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).
Spain is a constitutional monarchy, with a hereditary monarch and a bicameral parliament, the Cortes Generales or National Assembly. The executive branch consists of a Council of Ministers presided over by the President of Government (comparable to a prime minister), proposed by the monarch and elected by the National Assembly following legislative elections.
In 1898 Spain lost the Spanish-American War. Cuba gained its independence, and Spain lost its remaining New World colonies—Guam, the Philippines, and Puerto Rico—to the United States. Spain's colonial possessions were reduced to Spanish Morocco, Western Sahara and Equatorial Guinea.
The latter years of Franco's rule saw some economic and political liberalization, the so-called Spanish Miracle, including the birth of a tourism industry. Francisco Franco ruled until his death on November 20th 1975 when control was given to King Juan Carlos. In the last few months before Franco's death, the Spanish state went into a paralysis. This was capitalized upon by King Hassan of Morocco, who ordered the 'Green March' into Western Sahara, Spain's last colonial possession.
Spanish rule in Morocco ended in 1956. Though militarily victorious in the 1957-1958 Moroccan invasion of Spanish West Africa, Spain gradually relinquished its remaining African colonies. Spanish Guinea was granted independence as Equatorial Guinea in 1968, while the Moroccan enclave of Ifni had been ceded to Morocco in 1969.
Madrid is also noted for its nightlife and discotheques. Younger madrileños sometimes dance all night, stop off for chocolate y churros at dawn, go home, shower, shave, and go to work. This nightlife, called la movida or la marcha and initially focussed on the Plaza del Dos de Mayo, flourished after the death of Franco, especially during the 80's while Madrid's most cherished mayor Enrique Tierno Galván was in office. A particular hub for this night activity is nowadays the nearby gay village of Chueca. However, as prices continue to rise and more jobs become available, nightlife in Madrid is becoming more and more like that of other European cities such as Stockholm or Munich.
With the approval of the Spanish Constitution of 1978 and the arrival of democracy, the old historic nationalities — Basque Country, Catalonia, Galicia and Andalusia— were given far-reaching autonomy, which was then soon extended to all Spanish regions, resulting in one of the most decentralized territorial organizations in Western Europe.
Philip V, the first Bourbon king, of French origin, signed the Decreto de Nueva Planta in 1715, a new law that revoked most of the historical rights and privileges of the different kingdoms that conformed the Spanish Crown, unifying them under the laws of Castile, where the Cortes had been more receptive to the royal wish. Spain became culturally and politically a follower of France. The rule of the Spanish Bourbons continued under Ferdinand VI and Charles III. His son Carlos IV was truly incompetent (some say mentally handicapped), and under his reign Spain fell to the armies of Napoleon.
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.
A revived movement for the Christian unification of Spain was capitalized on by the "Catholic monarchs" (Reyes Católicos in Spanish) Isabel I of Castilla and Fernando II of Aragón in order to justify their invasion of Granada, the expulsion of the Jews and the forceful conversion of the Moors. In the 15th century, the Kingdoms of Castile and Aragon were united under Isabel and Fernando. These two able rulers ruled jointly and worked to consolidate the power of the monarchy at the expense of the nobility. During their reign, the castles of many nobles (symbols of aristocratic independence from the monarchy) were demolished, and a system of regular taxation was established. Fernando and Isabel established the basis for the unification of Spain religiously as well as politically and economically.
The 20th century initially brought little peace; colonisation of Western Sahara, Spanish Morocco and Equatorial Guinea was attempted as a substitute for the loss of the Americas. A period of dictatorial rule (1923-1931) ended with the establishment of the Second Spanish Republic. The Republic offered political autonomy to the Basque Country and Catalonia and gave voting rights to women. However, with increasing political polarisation and pressure from all sides, coupled with growing and unchecked political violence, the Republic ended with the outbreak of the Spanish Civil War in July 1936. Following the victory of the nationalist forces in 1939, General Francisco Franco ruled a nation exhausted politically and economically until his death in 1975.
Around 1,100 BC Phoenician merchants founded the trading colony of Gadir or Gades (modern day Cádiz) near Tartessos. In the 8th century BC the first Greek colonies, such as Emporion (modern Empúries), were founded along the Mediterranean coast on the East, leaving the south coast to the Phoenicians. The Greeks are responsible for the name Iberia, after the river Iber (Ebro in Spanish). In the 6th century BC the Carthaginians arrived in Iberia while struggling with the Greeks for control of the Western Mediterranean. Their most important colony was Carthago Nova (Latin name of modern day Cartagena).
Roman Catholicism is, by far, the most popular religion in the country, with four in five Spaniards (80%) self-identifying as Catholics. The next group (one in eight, or 12%) is represented by atheists or agnostics. Minority religions account for one in seventy (1.4%) of all Spaniards.