Llívia is an enclave in the Pyr­en­ees, legally part of Spain, but surrounded by French territory. Llívia residents themselves consider themselves firmly Cat­a­lan, with both sides of the Franco-Spanish border in this part of the Pyr­en­ees forming part of the Països Cat­a­lans.

The reason that Llívia is an enclave has to do with the terms of the 1659 Treaty of the Pyr­en­ees. The treaty stated that all villages north of the Pyr­en­ees were to become French, but the Spanish argued that Llívia was a town, not a village, given its history as the ancient capital of Cer­dan­ya back when it was a Roman province, and therefore not covered by this stipulation. The French did try to argue back but ultimately acquiesced. There is a little more detail on this in this Tim Traveller video(external link), albeit jazzed up for entertainment value.

Llívia is connected to Spain by means of a 1.8km road that the Spanish and French governments officially consider “neutral territory”, but has been subject to petty disputes in the past (like the French government installing stop signs to try to tell drivers on the access road they had to stop where the road crossed local French roads). Since the Schengen agreement was, uh, agreed to, most of the petty disagreements have stopped because there are no border crossings between Spain and France anyway. However, the Spanish did fail to dare to send paramilitaries and police into Llívia to beat up everyone attempting to vote in the 2017 Cat­a­lan independence referendum, the way they did in many other parts of Cat­a­lo­nia, presumably out of fear that the French would not appreciate the intrusion of such a force into French territory on their way to Llívia.