The referendum is over, and now the hard part begins. Both Leavers and Remainers will need to decide what leaving actually looks like: do we close ourselves off from Europe, or do we try to make Britain an open, self-confident trading nation?

The feeling of aimless panic that's been in the air since Friday 24 June – the feeling that nobody is in charge, that nobody knows what to do – cannot be left to linger. What's at stake is not just the economy but the Union and, above all, the country's sense of itself as a stable, united nation.

We need a plan, even if that plan doesn't work forever. That means a pragmatic compromise, one that secures the economy and reassures both markets and the public that someone is in charge and everything is going to be OK.

Retaining access to the Single Market is crucial. The Single Market prevents states from putting up tariffs or regulatory barriers to trade, making it extremely easy to buy and sell goods and services across different countries. What's more, the British economy has been shaped by the opportunities the Single Market has created. Of course we could survive without it, but it would mean destroying many jobs and successful firms and waiting for new ones to emerge. That would be a long, painful process.

Avoiding this means embracing the "EEA Option" – maintaining Britain's membership of the Single Market by joining the European Economic Area (EEA), while leaving the EU and introducing realistic reforms that control, but do not halt, immigration from Europe. If this is achievable then it will repair much of the economic damage that has been done since Friday, and will restore a sense of order to the country's politics.

The charges against the EEA are well-known: we must accept some EU regulations without having a say (though far fewer than we do currently, and many are decided by global bodies anyway); we have to pay in a fee to access the Single Market (albeit one quite a lot smaller than our current payments); and we must accept freedom of movement. This last point may be seen as a deal-breaker by people who interpret the referendum result as being about immigration as much as it was about leaving the EU.

Against these are the advantages. We get out of the EU, but there is no sharp shock for British businesses or consumers. Banks would retain passporting rights to operate in other Single Market countries, so the impact of Brexit on the City would be minor. The deep recession that many fear, and markets appear to be anticipating, would be avoided.

A vote Leave supporter Christine Forrester celebrates with others outside Vote Leave HQ, Westminster Tower Chris J Ratcliffe/ Getty Images

And being out of the EU has benefits of its own. The EEA states have full access to the Single Market but are not part of the EU's tariff system, so we can negotiate free trade deals with the rest of the world on our own terms, rather than wait for the whole of the EU to agree. In fact, Australia, New Zealand and Mexico have already been in touch. We can be open to the world and keep our deep trading relationship with Europe.

We can manage our own fisheries, and the Common Agricultural Policy, which has subsidised industrial farming for decades, can be scrapped altogether. On constitutional matters the European Court of Justice is gone, along with the prospect of being part of a comprehensive EU foreign policy or EU army.

Would this be acceptable to voters if it meant retaining freedom of movement? Once again the public may surprise us. Polling by YouGov, commissioned by the Adam Smith Institute before the referendum, found that voters would support the EEA option 54% to 25%, even if it meant retaining freedom of movement – a 2-to-1 margin.

Polling by The Sun asked voters how much personal annual income they would be willing to lose to cut the number of EU immigrants entering the UK. 9% said over £1,000, 5% said £500-£1,000. But the overwhelming majority, 68%, said they would not be willing to be any poorer at all.

Similarly the focus on "Hartlepool Leavers" from deprived Northern cities has distracted from the strong support for Leave from more well-heeled voters in the Home Counties and the South East. 49% of Leavers said their main reason for voting was to ensure that decisions about Britain were made in Britain; only 33% said controlling immigration was their main priority. The Leave coalition was even more fractious than most political coalitions are, and the easy explanation that this was a simple spasm of rage against immigrants just does not add up.

This isn't to deny that Freedom of Movement was a big part of why Leave won, and within the EEA Option the government should try to get as much control as possible, particularly over the impacts of immigration.

We need a safe, global Leave that takes control on immigration, without trying to halt it, and keeps us firmly inside the Single Market.

That might mean sacrificing some Single Market access in exchange for a monthly ceiling on numbers, and protection of the Emergency Brake on immigration that EEA members currently have. The government should create the necessary mechanisms to deport EEA migrants who have not found work after a few months – a power already available to it under EU rules – and re-establish a Migration Impact Fund that automatically and rapidly sends funds to public services in areas that have experienced a rise in immigration.

It would be a fantasy to imagine that we could have these things without giving up some of the perks of the Single Market, but they may be enough to satisfy the vast majority of Leavers who want control, but not necessarily end immigration from the EU.

There is a fringe that will be unhappy with anything short of a full stop on immigration. But a deep recession would embolden them even more than a compromise on immigration would. We cannot sacrifice hundreds of thousands of jobs just to appease that small minority of the country that genuinely does dislike all immigration.

Securing access to the Single Market would also disarm the SNP, who are dangerously close to calling another independence referendum. If they can persuade the Scottish public that it is economically safer to leave the UK and have Scotland try to join the EU on its own, they may be able to win independence. The EEA Option may be the one thing that can save the Union.

Frustratingly, some disappointed Remainers seem to have decided that the people have spoken, and now deserve to get what they voted for good and hard. They oppose the EEA Option because it cushions the blow they want Leavers to suffer. They join hardliners on the other side who will not budge an inch on immigration, even if it means plunging the country into misery.

For the rest of us though, now is the time for reconciliation. Most of us realise that compromise is necessary, no matter what side of the debate we were on. Leavers will have to take the lead and show that they have the interests of the country at heart. That means a safe, global Leave that takes control on immigration, without trying to halt it, and keeps us firmly inside the Single Market.

Sam Bowman is Executive Director of the Adam Smith Institute, a libertarian think tank. Follow : @s8m