When the Muslim army, led by Tariq ben Ziyad, crossed the Strait of Gibraltar in 711, it found the Visigoth kingdom, the heart of which was Toledo, in the midst of internal turmoil. For this reason, in just three years the army was able to reach Huesca and from there to launch the conquest of Catalonia and France on three fronts. Leaving the Pyrenees behind them, the Arab army invaded Aquitaine, where it was defeated at Poitiers (732) by the future Frankish king Charles Martel, the grandfather of the emperor Charlemagne, putting an end to the expansionism of the Muslim army.
The reaction of the Franks to the Muslim expansion did not waste time in making itself known. Ignoring the original borders of the Visigoth kingdom of Toledo, the Frankish incursion into the Iberian Peninsula came in successive waves. The first Frankish king who would successfully implement a stable border was Pepin the Short, who established the Pyrenees as a natural barrier against the advancing Arabs. His son, Charlemagne, intended to reach Saragossa and establish the river Ebro as the border (778). His defeat at Roncesvalles prevented him from doing so, and the Arab reaction was not long in coming: Abd al-Malik launched an attack during which his army besieged Girona and razed Narbonne to the ground. Following the death of Charlemagne, his son, Louis the Pious, continued with the Carolingian advance. He conquered Girona (785) and Barcelona (801), from where he tried to conquer Saragossa and Tortosa but was defeated. The Carolingian frontier with Muslim territory was thus defined and the “Marca Hispánica”, or Spanish March, was born.
The numerous borders of the Carolingian empire prevented the emperors from personally overseeing the defence of all of the border areas. In order to guarantee the defence of the frontiers, the emperors divided their territory into smaller fractions that were managed by a count who at this stage was an imperial civil servant named by the emperor. At the beginning of the 9th century there were six administrative units, or counties, in the Spanish March: Pallars-Ribagorça, Empúries-Peralada, Girona-Besalú, Urgell-Cerdanya, Rosselló-Vallespir and Barcelona.
The Arab armies continued to attack, and although the counties were treated equally, it soon became clear that Barcelona was the county that required the largest number of troops and the greatest economic resources, as it was the county that held the frontier. It was therefore favoured by the administration over the other counties and territories, and the other counties had an obligation to go to its aid (vassalage).
The privileges of some counts, the absence of Carolingian emperors in the area and the Arab incursions led to the rise of the first internal conflicts and an escalation in revolts against the Carolingian authorities. As a consequence of this infighting, counts that rebelled against the Carolingian authority were removed from office, while those who remained loyal were compensated with other counties. Thus Wilfred the Hairy, Count of Urgell-Cerdanya, also received the honour of the counties of Osona, Girona and Barcelona, and the leadership that the House of Barcelona would exert over Catalonia throughout the mediaeval period began.
The counties, united under the figure of Wilfred the Hairy, formed a crescent around Osona, which had become depopulated. Wilfred had two main responsibilities: to defend the frontier with the Muslim army and to repopulate Osona. To bring about this repopulation, he founded two monasteries, the Monastery of Sant Joan de les Abadesses and the Monastery of Santa Maria de Ripoll.
From its foundation, the monastery of Ripoll was the geographical and spiritual centre of Catalonia, beyond the boundaries of the counties. Wilfred the Hairy gave the monastery to his son Radulf to act as abbot and granted land scattered throughout his counties to the monastery. Wilfred continued to fight against Arab attacks, perishing in one of these battles.
Wilfred was buried in the monastery of Ripoll, which marked the start of the monastery’s use as a dynastic pantheon. Following in Wilfred’s footsteps, noble families from throughout Catalonia bequeathed their land to the monastery, and some counts were buried there upon their deaths. As a result, Ripoll’s identity was forged and intertwined with the birth of Catalonia.
After Wilfred’s death, his sons inherited all of their father’s counties, which meant that the office of count, which had previously been a lifelong post decided by the Carolingian emperors, became a hereditary title, and the dynasty of the House of Barcelona began.
With the following generations of Wilfred’s descendents the counties were divided, until in the 11th century the Counts Bernard Tallaferro of Besalú and Ramon Borrell of Barcelona began consolidating their land to the south. This provoked a number of Muslim raids, the most important of which was the attack on Barcelona, which was destroyed in 985 by al-Mansur.
The House of Barcelona continued to extend its vassalage links with all of the noble families until its counts were the only ones who were bound to no one, not even the Pope. Ramon Berenguer I, Count of Barcelona, was practically king of Catalonia; his power over the other counties increased ceaselessly.
The predominance of the House of Barcelona was confirmed during the time of Ramon Berenguer III, who absorbed Besalú and Cerdanya, extending his influence to Occitan and consolidating the New Catalonia. Ramon Berenguer IV controlled this territory after his marriage to Petronella of Aragon, which meant the unification of the Catalan counties with the Crown of Aragon. From Ramon Berenguer IV, the counts of Barcelona would also be the kings of Aragon.