Andorra has been populated for thousands of years since artifacts have been found that date back to the Neolithic period around five thousand and eight thousand years ago. Bronze Age relics have been found as well. It is presumed that the first inhabitants of the valleys of Andorra were originally from the Basque region in northern Spain. Andorra was also settled by Celt tribal migrations and Iberians at a time. During Roman times, Andorra was part of empire. During the Moorish invasion of Spain, after the Moors beat out the Spanish King Roderick, the Moors trampled through Northern Spain and it is believed that some Spanish refugees found the Pyrenees Mountains of Andorra good shelter from the social turmoil in Spain. As the Moors continued to invade France, the Andorran locals contacted Charlemagne to intervene. Historians report that in 803 AD Charlemagne beat out the Moors and conquered the territory.
    In 843, Charlemagne’s grandson gave the Count of Urgell, a Spanish count, the valleys of Andorra. In 1278, the princes of  Urgell and the French count of Foix worked out an agreement to share the lands called the Paretages, which established the tiny nation's sovereignty.  Thus, until very recently, Andorrans were ruled by both French and Spanish leaders. After the French Revolution, all feudal rights were abolished and the Count of Foix was forced to forfeit the lands until Napolean restored the agreement in 1803.  
    During World War II, Andorra was a key point for smuggling Spanish supplies and goods over the border into France during the Occupation. It was only after World War II that Andorra made its name known as a tourist destination and ski resort. Thus, Andorra continued to be a shared co-principality between France and Spain. In 1993, a parliamentary form of government was established and the co-princes became merely titular heads of state.