In 801, King Louis the Pious of Aquitaine established the County of Barcelona as a "march," or border area, for the Frankish Empire. In 1137, Count Ramon Berenguer IV was betrothed to Petronila, queen of Aragon. This created the Kingdom of Aragon. Aragon was a major European power with control of the western Mediterranean. Until 1410, Catalonia was the dominant region. The kingdom spoke Occitan, a language also spoken in southern France at this time. This language was favored by the troubadours and a great deal of medieval literature is written in it.
Aragon and Castile were united into a single Spanish kingdom by the marriage of Ferdinand and Isabella in 1469. Catalonia retained the Generalitat, a regional parliament, until the War of Spanish Succession (1701-1714). In this war, Catalonia sided with the Habsburg claimant and thus lost its autonomy when the Bourbons gained the Spanish throne.
Many Catalans supported the Carlist revolt of 1833–39. Catalonian nationalism emerged during the Renaixença of the 1850s. The Catalan language revived at this time.
Barcelona was a Republican stronghold during the Spanish Civil War of 1936-1939. The city's role is described in George Orwell's memoir Homage to Catalonia. Catalonians particularly resented the rule of Spanish leader Francisco Franco (1939-1975).
On October 1, 2017, Catalonia voted to leave Spain, and the EU, a move which has angered the Spanish government, leading to a brutal crackdown. Catalonia is the most left wing region of Spain. A successful secession would leave a conservatives firmly in charge of the government in Madrid.