Count of Barcelona

The Count of Barcelona (, , , ) was the ruler of the County of Barcelona and, by extension, the Principality of Catalonia for much of Catalan history, from the 9th century until the 18th century.
History.
The County of Barcelona was created by Charlemagne after he had conquered lands north of the river Ebro and Barcelona, after a siege in 801. These lands, called the "Marca Hispanica", were partitioned into various counties, of which the count of Barcelona, usually holding other counties simultaneously, eventually obtained the primacy over the region. As the county became hereditary in one family, the bond of the counts to their Frankish overlords loosened, especially after the Capetian dynasty supplanted the Carolingians.
In the 12th century, the counts of Barcelona became kings of Aragon through inheritance, establishing the Crown of Aragon. In 1258, the king of France relinquished his claim of feudal authority over the county in the Treaty of Corbeil. The counts were also hereditary kings of Castile from the 16th century, eventually forming the Kingdom of Spain. The title of count of Barcelona remained one of the many hereditary titles of the Spanish monarchy.
In the 20th century, the title regained some prominence when Juan de Borbón, the exiled heir to the Spanish throne, adopted the title of count of Barcelona. In doing so, he claimed a historical royal title without claiming to be the current king of Spain, especially after his son Juan Carlos became the prospective successor of the then-ruler of Spain, Francisco Franco. In 1977, after Juan Carlos had become king upon Franco's death in 1975, he officially awarded the comital title to his father, who had renounced his rights to the throne. Juan held that title until his death in 1993, when it reverted to Juan Carlos. Juan de Borbón's widow used the title countess of Barcelona until her death in 2000.
List of counts of Barcelona.
House of Sunifred, 878–1162.
The succession of Ramon Berenguer IV and Petronilla led to the creation of the Crown of Aragon.
House of Barcelona, 1164–1410.
Martin was the last direct descendant of Wilfred the Hairy to rule; died without legitimate heirs ("interregnum" 31 May 1410 – 24 June 1412). By the Compromise of Caspe of 1412 the County of Barcelona and all its associated dominions passed to a branch of the House of Trastámara.
The County of Barcelona formed a constituent part of the Crown of Spain under the rule of the House of Habsburg, until the Nueva Planta decrees (1707 and 1716), when Philip de Bourbon declared that all the territories from the Crown of Aragon should merge into Castile, building the centralized Kingdom of Spain. In Barcelona this was promulgated in 1716, and the title of Count of Barcelona became one of the many unused hereditary titles of the modern Spanish monarchy.
Reapers' War, 1641-1659.
During the Reapers' War, the States-General ("Braços Generals") on 21 January 1641 declared the French king Louis XIII Count of Barcelona as Louis I. Despite the reconquest of Barcelona by Spain in 1652, the kings of France held on to the part of Catalonia north of the Pyrénées, where Catalan institutions remained. This lasted until the conclusion of the Franco-Spanish War and the signing of the Treaty of the Pyrenees in 1659, where French authorities renounced Catalonia, but received Northern Catalonia, which became the French province of Roussillon.