In 1659, the Treaty of the Pyrenees aimed to settle the Franco-Spanish War by ceding thirty-three Catalan villages in the Cerdanya region from the Spanish Crown to France. However, when diplomats finalized the specifics in the subsequent 1660 Treaty of Llívia, Spanish negotiators pointed out a crucial legal technicality: Llívia was historically designated as a town ('villa') rather than a village ('pueblo'). Because Llívia had held the status of a villa since ancient Roman times, Spain successfully argued that it was explicitly exempt from the terms of the treaty.
As a result, France annexed all surrounding villages, leaving Llívia completely isolated as a Spanish island inside French sovereign territory. Subsequent treaties, including the 1801 Treaty of Madrid and the 1866 Treaty of Bayonne, further refined border protocols, establishing a neutral road connecting Llívia to Spain. Today, Llívia operates under Spanish jurisdiction, uses Spanish municipal laws, and relies on a unique cross-border treaty system for municipal services like water, emergency response, and healthcare, making it one of the most intriguing geopolitical anomalies in Western Europe.