FOR the European Union’s high priesthood in Brussels, the right of people to live and work anywhere in Europe is sacred. But free movement is a worldlier concern for Franco Puffi, who runs Precicast, a high-tech metal foundry in Ticino, a Swiss canton next to the Italian border.

Fully 90% of those who toil in its workshops are Italian, as are the engineers who design its moulds and the managers who seek new export markets for aerospace and biomedical components. Mr Puffi would like to employ more locals, but says the Swiss prefer banking and public-sector jobs. Northern Italians, by contrast, value industrial work and have the technical skills he needs. Their country’s economic woes make them “hungrier”. And there are a lot more of them.

For others, that is precisely the problem. “Ticino is confronted with Italy,” says Norman Gobbi of the Ticino League, a local party that backs immigration curbs. “And Italy is an example of the non-functioning of the EU.” Switzerland, a small, federal construct that protects its sovereignty furiously—it became a full UN member only in 2002—is in many respects a curiosity. Its relationship with the EU, governed by a complex set of bilateral deals, is no exception. But its recent experience provides lessons for others, not least a Brexiting Britain, on how far European states outside the EU can set the terms of their relationship with the union.

Since 2002 all EU citizens have had the right to live and work in Switzerland (and vice versa).

Millions of Italians live within 50 kilometres of the border. Tens of thousands of them commute across it every day. In 2014 concerns that Italians were undercutting local wages drove 68% of Ticinese to vote “yes” in a national referendum that called for curbs on immigration and cross-border commuting. The proposal squeaked through by 20,000 votes. Some credit the Ticinese with its victory.

In doing so they landed Switzerland with a giant headache. A “guillotine” clause in Switzerland’s accords with the EU means that unilaterally overturning the free-movement provisions jeopardises the rest of the agreements reached in 2002, which cover everything from procurement to agriculture. One government study found that scrapping all this could, by 2035, leave Swiss GDP 7.1% lower than it would otherwise be.

Owing largely to immigration, the Swiss population has grown by over 10% in a decade. As a country of nothing but “water and rocks”, in the words of Paolo Beltraminelli, the centrist president of Ticino, Switzerland has always had to look abroad to plug labour gaps. But anti-immigrant populists have a deadly weapon: the popular initiative, which triggers lots of referendums. In 1970 a proposal to cap immigrants at 10% of the total population (bar Geneva) almost succeeded; today the figure is 23%. Votes against burqas and minarets have followed, as concerns about asylum-seekers and Muslims were added to the mix.

The EU was at first minded to compromise with Switzerland over free movement. But that changed after last year’s election in Britain returned a government with a mandate to renegotiate its EU membership. Fearful that concessions to the Swiss would be seized on by the British, the EU toughened its stance; the Brexit vote in June made things worse. Now the Swiss look set to back down. This week the lower house of parliament approved a law that encourages employers to recruit in Switzerland before looking abroad; hardly the strict curbs demanded by the right-wing Swiss People’s Party (SVP) that proposed the referendum.

Infuriated, the SVP could seek a second referendum to overturn the law, or to tear up the bilateral deals entirely. The Ticinese won’t wait: on September 25th they are set to approve a local initiative, backed by Mr Gobbi, to privilege Swiss workers over foreigners. The proposal is a legal nonsense; such matters are national rather than cantonal responsibilities. Much more of this sort of thing, says Mr Puffi, and he will move Precicast to Italy.

Given the choice, Swiss voters tell pollsters they would not ditch the accords with the EU to cut immigration. But hardliners think the backlash against migration across the EU means that one day Brussels will have to take a less rigid stance; and that it is in the EU’s interest to keep Switzerland happy. The parallels with the British debate are irresistible: Brexiteers, too, argue that the EU will have to bow before the will of referendum voters. Yet Britain’s vow to cut immigration from the EU will mean losing some access to the single market, possibly including the “passporting” rights that allow financial firms to operate freely across the EU. Confronted with the potential collapse of Britain’s most important trading relationship, the promise to keep out Polish workers will look less compelling, or so some pro-EU voices suggest.

The meaning of sovereignty
There is another lesson from the Alps. The Swiss are hanging tough for now on a further EU demand: that the “static” bilateral agreements become “dynamic”, meaning that Switzerland automatically accepts new developments in EU law, be they new rules from Brussels or rulings by the European Court of Justice. Foreign judges are as distrusted in Switzerland as they are in Britain, and the Swiss can in theory pick and choose which rules to apply (in practice many are simply copy-pasted from Brussels). Refusing the EU’s demands means Switzerland will be cut out of future single-market developments, such as energy integration.

Britain will face a similar dilemma. Whatever access it maintains to the single market, the rules will inevitably change; if Britain does not apply them automatically it will be progressively excluded from it. Britain may be far larger than Switzerland, a small country surrounded by the EU; and its security and police ties with the rest of Europe give it extra clout in striking a deal. But like Switzerland, Britain will face tough questions about what it means to preserve sovereignty when its biggest trading partner is making rules over which it will have no say.

Immigration could be the least of its worries.