History of Andorra

Andorra, officially the Principality of Andorra (), is a microstate located in the eastern Pyrenees mountains and bordered by Spain and France.
Andorra claims it is the last independent survivor of the Marca Hispanica. This was the buffer states created by Charlemagne to keep the Islamic Moors from advancing into Christian France. According to the tradition, Charlemagne granted a charter to the Andorran people in return for their fighting the Moors. In the 9th century, Charlemagne's grandson, Charles the Bald, named the Count of Urgell as overlord of Andorra. A descendant of the count later gave the lands to the Diocese of Urgell.
In the 11th century, the Bishop of Urgell placed himself under the protection of the Lord of Caboet, a Catalan nobleman. Later, the Count of Foix became heir to the Lord of Caboet through marriage in 1208. A dispute arose between the Occitan Count and the Catalan bishop over Andorra.
In 1278, the conflict was resolved by the signing of a pareage (pariatges). This stated that Andorra's sovereignty was shared between the Count of Foix and the Bishop of La Seu d'Urgell (Catalonia). The pareage gave the small state its territory and political form. In return, Andorra pays an annual tribute or questia to the co-rulers consisting of four hams, forty loaves of bread, and some wine. Andorra's borders have remained unchanged since 1278.
Andorra was briefly annexed to the Crown of Aragon twice, in 1396 and 1512.