The great invasions of Andorra began in the 5th century: after the fall of the Roman Empire Andorra came under the influence of the Visigoths. The Visigoths from Narbonne conquered Andorra in 414 and only in 714 were driven out by the Arabs who remained there until 785, when the Franks took full control of the region.
In fact, Andorra was created in 788, in one of the fights against the Arabs. According to the legend, Charlemagne founded Andorra in recognition of the help provided by local people in their fight against the Saracens.
Then the grateful future emperor declared the Andorrans "sovereign people" and granted them a charter of freedom. It is hard to understand how Andorra became independent because the real history is mixed here with legends. Nevertheless, there is no doubt that Charlemagne made Andorra part of the Spanish Marches. In fact, these buffer territories protected France from new Arab invasions.
After the Arabs left the land it became possible to completely reconstruct the Cathedral of Santa Maria d'Urgell. In 839, at the day of its consecration, the Andorrans of six parishes (Andorra and Lòria, Canillo, La Massana, Encamp, Ordino and Santa Coloma) swore an oath to the Bishop of Urgel. In the 9th century Charles the Bald, Charlemagne's grandson, named Count Sunifred I of Cerdan-Urgell suzerain of Andorra. In 1133 Ermengol VI, a descendant of the count, gave his lands in Andorra to the diocese of Urgel, in 1186 the Andorrans accepted a new suzerain and swore an oath to the bishop.



