In the late 8th century, the counties of the March of Gothia and the Hispanic March were established by the Frankish kingdom as feudal vassals across and near the eastern Pyrenees as a defensive barrier against Muslim invasions. The eastern counties of these marches were united under the rule of the Frankish vassal, the count of Barcelona. In the 10th century the County of Barcelona became independent de facto. In 1137, Barcelona and the Kingdom of Aragon were united by marriage under the Crown of Aragon. The de jure end of Frankish rule was ratified by French and Aragonese monarchs in the Treaty of Corbeil in 1258. The Principality of Catalonia developed its own institutional system, such as courts (parliament), and constitutions, becoming the base for the Crown of Aragon's naval power, trade and expansionism in the Mediterranean. In the later Middle Ages, Catalan literature flourished. During the last Medieval centuries natural disasters, social turmoils and military conflicts affected the Principality. Between 1469 and 1516, the king of Aragon and the queen of Castile married and ruled their realms together, retaining all of their distinct institutions and legislation.
During the Franco-Spanish War (1635–1659), Catalonia revolted (1640–1652) against a large and burdensome presence of the royal army in its territory, being briefly proclaimed a republic under French protection. Within a brief period France took full control of Catalonia, until it was largely reconquered by the Spanish army. Under the terms of the Treaty of the Pyrenees in 1659, the Spanish Crown ceded the northern parts of Catalonia, mostly the County of Roussillon, to France. During the War of the Spanish Succession (1701–1714), the Crown of Aragon sided against the BourbonPhilip V of Spain; following Catalan defeat on 11 September 1714, Philip V, inspired by the model of France imposed a unifying administration across Spain, enacting the Nueva Planta decrees, suppressing the main Catalan institutions and rights like in the other realms of the Crown of Aragon. This led to the eclipse of Catalan as a language of government and literature, replaced by Spanish. Along the 18th century, Catalonia experienced economic growth, reinforced in the late quarter of the century when the Castile's trade monopoly with American colonies ended.
In the 19th century, Catalonia was severely affected by the Napoleonic and Carlist Wars. In the second third of the century, Catalonia experienced significant industrialisation. As wealth from the industrial expansion grew, Catalonia saw a cultural renaissance coupled with incipient nationalism while several workers movements appeared. In 1914, the four Catalan provinces formed a commonwealth, and with the return of democracy during the Second Spanish Republic (1931–1939), the Generalitat of Catalonia was restored as an autonomous government. After the Spanish Civil War, the Francoist dictatorship enacted repressive measures, abolishing Catalan self-government and banning the official use of the Catalan language again. After a first period of autarky, from the late 1950s through to the 1970s Catalonia saw rapid economic growth, drawing many workers from across Spain, making Barcelona one of Europe's largest industrial metropolitan areas and turning Catalonia into a major tourist destination. Since the Spanish transition to democracy (1975–1982), Catalonia has regained considerable autonomy in political, educational, environmental, and cultural affairs and is now one of the most economically dynamic communities of Spain. In the 2010s there has been growing support for Catalan independence. On 27 October 2017, the Catalan Parliament declared independence from Spain following a disputed referendum. The Spanish Senate voted in favour of enforcing direct rule by removing the entire Catalan government and calling a snap regional election for 21 December. On 2 November of the same year, the Spanish Supreme Court imprisoned seven former ministers of the Catalan government on charges of rebellion and misuse of public funds, while several others—including then-President of Catalonia, Carles Puigdemont—fled to other European countries (such as Belgium, in Puigdemont's case).
The name Catalonia—Catalunya in Catalan, spelled Cathalonia, or Cathalaunia in Medieval Latin—began to be used for the homeland of the Catalans (Cathalanenses) in the late 11th century and was probably used before as a territorial reference to the group of counties that comprised part of the March of Gothia and March of Hispania under the control of the Count of Barcelona and his relatives. The origin of the name Catalunya is subject to diverse interpretations because of a lack of evidence.
One theory suggests that Catalunya derives from the name Gothia (or Gauthia) Launia ("Land of the Goths"), since the origins of the Catalan counts, lords and people were found in the March of Gothia, known as Gothia, whence Gothland > Gothlandia > Gothalania > Cathalaunia > Catalonia theoretically derived. During the Middle Ages, Byzantine chroniclers claimed that Catalania derives from the local medley of Goths with Alans, initially constituting a Goth-Alania.
Other less plausible or recent theories suggest:
Catalunya derives from the term "land of castles", having evolved from the term castlà or castlan, the medieval term for a castellan (a ruler of a castle). This theory therefore suggests that the names Catalunya and Castile have a common root.
The source is of Celtic origin, meaning "chiefs of battle". Although the area is not known to have been occupied by the Celtiberians, a Celtic culture was present within the interior of the Iberian Peninsula in pre-Roman times.
Miguel Vidal, finding serious shortcomings with earlier proposals (such as that an original -t- would have, by normal sound laws in the local Romance languages, developed into -d-), suggested an Arabic etymology: qattāl (قتالو, pl. qattālūnقتالون) – meaning "killer" – could have been applied by Muslims to groups of raiders and bandits on the southern border of the Marca Hispanica. The name, originally derogatory, could have been reappropiated by Christians as an autonym. This is comparable to attested development of the term Almogavar in nearby areas. In this model, the name Catalunya derives from the plural qattālūn while the adjective and language name català derives from the singular qattāl, both with the addition of common Romance suffixes.