The establishment of the Carolingian Empire signalled the transition from the Europe of late Antiquity to Europe of the Middle Ages. The future Catalonia, at the gates of the Islamic world, began its reconstruction under the protection of the Empire.
Under the Carolingians these border territories were set up in counties. Over time the Carolingian domination became weaker and the county dynasties, arising as they did from native lineages, often broke their bonds of vassalage and looked for their own sense of identity. Wilfred the Hairy ( Guifré el Pelós), Count of Cerdanya and Urgell, brought the counties of Girona, Barcelona and Osona under his control and established Barcelona's ruling dynasty.
The first attempts at territorial expansion into Moorish territory took place at the end of the tenth century. These attempts effectively became the breaking of ties with the Frankish power and the beginning of political independence.