Overview
The County of Barcelona was a polity in northeastern Iberian Peninsula, originally located in the southern frontier region of the Carolingian Empire. In the 10th century, the Counts of Barcelona progressively achieved independence from Frankish rule, becoming hereditary rulers in constant warfare with the Islamic Caliphate of Córdoba and its successor states. The counts, through marriage, alliances and treaties, acquired or vassalized the other Catalan counties and extended their influence over Occitania. In 1164, the County of Barcelona entered a personal union with the Kingdom of Aragon. Thenceforward, the history of the county is subsumed within that of the Crown of Aragon, but the city of Barcelona remained preeminent within it.
Within the Crown, the County of Barcelona and the other Catalan counties progressively merged into a polity known as the Principality of Catalonia, which assumed the institutional and territorial continuity of the County of Barcelona.
Origins
Its origins date back to the early 8th century, when Muslims took control of the northern territories of the Visigothic Kingdom in Hispania and modern-day northeastern Spain and southern France. After turning back deep Muslim incursions, the Frankish Empire under the Carolingian monarchs, created the hystoriographycally Marches of Gothia and Hispania progressively. This was achieved by taking over the territories of Septimania that the Moors invaded in the 8th century and from these, those territories surrounding the Pyrenees and specially the northeast of the Iberian Peninsula. These eastern Iberian territories were repopulated with people from the March of Gothia.
This resulted in the formation of an effective buffer zone between the Muslim Iberian peninsula and the Duchy of Aquitaine and Provence.
From Wikipedia (CC BY-SA 4.0).