Having reached the political summit with surprising ease, Theresa May has headed to the Swiss Alps for her summer holiday. She enjoys the adventurous hikes, stunning views and solitude away from the frenzy of Westminster. After a slightly frosty photo opportunity, our new prime minister will no doubt spend her fortnight’s break pondering the challenges ahead when she returns to work.

No wonder she was “distinctly unimpressed” to be disturbed by a tussle between two Brexit ministers, with the leak of a letter from the international trade secretary, Liam Fox, proposing a raid on Foreign Office staff and a diminution of Boris Johnson’s remit. These ministers seem short of experts able to turn ill-defined ideas of independence into reality – despite the dismissive comments made during the referendum campaign. Now they know they are in the line of fire if promises made to voters turn to dust, with talk already of Britain remaining in the European Union until 2019.

So it is apt that May chose to return to this particular destination, since no other nation better shows the mountainous problem confronting her government. Switzerland demonstrates with stark clarity the core issue that will define her time in Downing Street: how to resolve the conundrum of having open European borders for goods and services, but closing them for people.

Just as in Britain, the problem was presented to Swiss politicians by a referendum focused on immigration, after economic success lured a flood of foreigners. One in four residents were born abroad: people such as British bankers, German teachers and Italian doctors. Although not an EU member, the country is signed up to the Schengen pact on free movement. And this led a rightwing party to exploit concerns over public services and wages by pushing a ballot to stop “mass migration”.

The Swiss People’s party, by a tiny majority, was backed by voters in February 2014. But the EU does not permit cherry-picking of rules. So Brussels instantly fired a warning shot by blocking Swiss universities from research projects, and students from exchange programmes. The Swiss government made up funding shortfalls, just as Philip Hammond, the UK chancellor, promised to do at the weekend – but enforced isolation in such a dynamic global sector had a damaging impact, with an estimated 80 top academics already spurning jobs.

Now the nation is stuck in a trap: mandated by voters to bring in controls by next February – yet, with more than 80% of migrants coming from Europe, threatened with internal market expulsion if it does so, which would inflict calamitous economic damage. Official studies suggest that if forced to break bilateral deals that cover everything from agriculture to civil aviation, Switzerland’s gross domestic product will fall by at least 7% within two decades. Breaching one of its EU agreements nullifies them all.

Under their spurious vision of freedom, the likes of Nigel Farage, the former Ukip leader, say they would happily have lower growth in return for fewer foreigners. But downturn – even slower growth – would mean potentially severe hardship for many people less wealthy than the featherbedded MEP. Britain, like Switzerland, relies on migrants not just to fuel its economy but to prop up key public services such as healthcare.

Brexit campaigners arrogantly insist Brussels will rush to accommodate the world’s fifth biggest economy, just as they claim it will be easy to sort out trade deals around the world – despite Britain’s lack of expertise, a result of being part of the EU for so long. But, as I was told by Christa Markwalder, the president of Switzerland’s National Council, the EU position is clear: “Either you follow all the rules to play in their major league or you do not have market access.”

It took the Swiss 17 years to negotiate one insurance agreement

Swiss lessons go deeper than just the headache created by its referendum. Two decades earlier, voters in this bastion of direct democracy rejected a decision to join the European Economic Area with Norway, ending moves to enter the EU. This led to long negotiations for more than 100 of those bilateral deals. Analysts say “toxic” uncertainty created during the process played a key role in what they call the “lost 90s”, when the economy stagnated and suffered high unemployment.

Already Eurosceptic zealots are pressing May to trigger article 50, which starts the formal two-year exit process. One expert in Zurich laughed when I suggested a country with an economy as complex as Britain could sort out a new trade deal with Europe in this time. It took the Swiss 17 years to negotiate one insurance agreement; there has still been no deal on joining the open market for financial services, one reason their banks set up offices in the City of London.

Swiss politicians are struggling to find a solution. “The clock ticks louder each week,” said Jan Atteslander, of the Swiss Business Federation. There is talk of benefit restrictions, possibly a “safeguard clause” imposing temporary limits on migration. But this is tinkering at the edges.

Now there is a possible escape route, with the requisite 100,000 signatures collected for a fresh vote to reverse the earlier referendum. So as she tramps along those gorgeous Alpine paths, could there be a better place for our prime minister to contemplate the future of her own country?