Andorra /ænˈdɔərə/ (help·info), officially the Principality of Andorra (Catalan: Principat d'Andorra), also called the Principality of the Valleys of Andorra, is a small landlocked country in western Europe, located in the eastern Pyrenees mountains and bordered by Spain and France. It is currently a prosperous country mainly because of tourism and its status as a tax haven. The people of Andorra are currently listed as having the highest human life expectancy in the world, at an average of 85 years at birth.
Andorra is the sixth smallest nation in Europe. Tradition holds that Charles the Great (Charlemagne) granted a charter to the Andorran people in return for fighting against the Moors. Overlordship of the territory was of the local count of Urgell and eventually to the bishop of the diocese of Urgell.
In 988 Borrell II count of Urgell gave the Andorran valleys to the Diocese of Urgell when the count expanded to the south. Since then the Bishop of Urgell, locally known as the bishop of the la Seu d'Urgell, has owned Andorra. Andorra did not have any type of protection and the Bishop of Urgell, who knew that the Count of Urgell wanted to reclaim the Andorran valleys, decided to ask for help and protection from the Lord of Caboet.
In 1095, the Lord of Caboet and the Bishop of la Seu d'Urgell signed under oath the recognition of their sovereignty over Andorra. Arnalda, daughter of Arnau of Caboet, married the Viscount of Castellbò and both became Viscounts of Castellbò and Cerdanya. Years later their daughter, Ermessenda, married Roger Bernat II of the French Count of Foix.
They became Roger Bernat II and Ermessenda I Counts of Foix, Viscounts of Castellbò and Cerdanya and also sovereigns of Andorra (shared with the Bishop of Urgell).