Andorra claims it is the last independent survivor of the Marca Hispanica, the buffer states created by Charlemagne to keep the Islamic Moors from advancing into Christian France. Tradition holds that 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, fearing military action by neighboring lords, the Bishop of Urgell placed himself under the protection of the Lord of Caboet, a Catalannobleman. Later, the Count of Foix became heir to the Lord of Caboet through marriage in 1208, and 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, which provided that Andorra's sovereignty be shared between the Count of Foix and the Bishop of La Seu d'Urgell. The pareage, a feudal institution recognizing the principle of equality of rights shared by two rulers, 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. In 1505, Germaine of Foix married Ferdinand V of Castile, thereby bringing the lordship of Andorra under Spanish rule. On taking over the kingdom in 1519, Emperor Charles V granted the lordship of Les Valls, as it was then known, to Germaine of Foix's line in perpetuity. Calvinist king Henry III of Navarre, who was also count of Foix, in 1589 ascended the French throne as Henry IV, and by an edict of 1607 transferred his role as co-prince of Andorra to the head of the French state. In 1793, the French revolutionary government refused the traditional Andorran tribute as smacking of feudalism and renounced its suzerainty, despite the wish of the Andorrans to enjoy French protection and avoid being under exclusively Spanish influence. Andorra remained neutral during the Napoleonic Wars. Napoleon restored the co-principality in 1806 after the Andorrans petitioned him to do so. French title to the principality subsequently passed from the kings to the president of France. In the period 1812–13, the French Empire annexed Catalonia and divided it in four departments. Andorra was also annexed and made part of the district of Puigcerdà.
20th and 21st centuries
In 1933, France occupied Andorra as a result of social unrest before elections. On July 12, 1934, an adventurer named Boris Skossyreff issued a proclamation in Urgel, declaring himself Boris I, sovereign prince of Andorra, simultaneously declaring war on the Bishop of Urgell. He was arrested by Spanish authorities on July 20 and ultimately expelled from Spain. From 1936 to 1940, a French detachment was garrisoned in Andorra to prevent encroachment as a result of the Spanish Civil War and Francoist Spain. During World War II, Andorra remained neutral and was an important smuggling route from Spain into France. The French Resistance used Andorra as part of their route to get downed airmen out of France. In 1943, Andorra carried out its first execution since the 19th century: Antoni Arenis was executed for double fratricide by firing squad because a trained executioner was unavailable to operate the legal method, by garrote. In 1958, Andorra declared peace with Germany. It had been forgotten in the Treaty of Versailles that ended World War I and so the conflict had been extended by the lack of a peace treaty, and both had legally remained at war. Long an impoverished land with little contact with any nations other than adjoining France and Spain, Andorra, after World War II, achieved considerable prosperity through a developing tourist industry. That development, abetted by improvements in transport and communications, has tended to break down Andorra's isolation and to bring Andorrans into the mainstream of European history. Public demands for democratic reforms led to the extension of the franchise to women in the 1970s and to the creation of new and more fully autonomous organs of government in the early 1980s.
Andorra formally became a parliamentary democracy in May 1993 following approval of a new constitution by a popular referendum in March 1993. The new constitution retained the French and Spanish co-princes although with reduced and narrowly defined powers. Civil rights were greatly expanded, including the legalisation of political parties and the provision for an independent judiciary. Andorra joined a customs union with the European Communities in 1991 and was admitted to the United Nations on 28 July 1993. It became a member of the Council of Europe in 1994. The country has been seeking ways to improve its export potential and increase its economic ties with its European neighbours. The financial services sector of the economy is highly important because of Andorra's status as a tax haven and its banking secrecy laws.