Gloom is the prevailing emotion among legal practitioners after the referendum. But we must all adapt.

In welcoming journalists to the Hogan Lovells press party last week, the firm’s regional managing partner Susan Bright said that her constitutional change taskforce of 30 lawyers had spent the past 18 months working on a Brexit plan — which she had expected to tie up in a big red bow and put away for good.

It was not to be. At least law firms were better prepared than the government which, even now, must be ringing round and commissioning lawyers. But there was still a mood of gloom in places where law is practised and justice delivered. Brits were searching their family trees for ancestors from EU countries. People with EU passports were feeling peculiarly vulnerable.

Some of those feelings were irrational. Whatever happens, a UK passport will still open more doors than one from, say, Iceland (whose EU entry application is currently ‘frozen’). Professionals with EU passports will not have to leave the UK.

But shock often produces an irrational response. My own immediate reaction was to say: ‘Cheer up, it may never happen’. In this, I was not alone. Gideon Rachman, chief foreign affairs commentator at the Financial Times for the past 10 years, reminded us that the usual response when an EU referendum produced the wrong result was to hold another referendum. ‘There is a moderate middle in both Britain and Europe that should be capable of finding a deal that keeps the UK inside the EU,’ he said.

Others are pinning their hopes on a legal challenge to the referendum result or an early general election. A government elected on a manifesto commitment to remain in the EU could plausibly ignore the referendum result – which, as a matter of law, was not binding.

As the week drew on, though, people began to accept the political realities. It was not just the ignorant and the xenophobic who had voted to leave the EU. A retired solicitor from Surrey told me he was worried his vote would count for nothing. A schoolteacher from Northern Ireland said that protesters from the Remain camp were behaving like bad losers. Leading Conservatives acknowledged that however much economic damage would be caused by leaving the EU, the political damage caused by staying in would be much greater. People would no longer trust the government to govern.

As article 50 of the Treaty on European Union says, the decision to withdraw must be taken by the UK ‘in accordance with its own constitutional requirements’. A number of distinguished QCs – Lord Lester of Herne Hill, Lord Pannick, Sir Jeffrey Jowell – argue that this requires legislation because triggering article 50 would, in effect, undermine the European Communities Act 1972.

The alternative view is that the conduct of foreign affairs is a prerogative power that can be exercised by the prime minister without parliamentary approval. But Pannick, supporting three constitutional lawyers who first came up with the idea, argues that prerogative powers may be used only if their subject matter has not already been addressed by legislation.

Late last week, it emerged that Remain supporters were planning to litigate this point, ideally before a new prime minister takes office in September. My own view is that the legal challenge will not achieve very much. The courts are as reluctant to get involved in matters of parliamentary procedure as they are to decide hypothetical questions.

In any event, I suspect a bill would get through the Commons – and not be blocked for long by the Lords – provided the government can reassure parliament that it has a reasonable chance of achieving a deal. To reach that stage the new prime minister may need several months of bilateral discussions with the remaining EU states, despite the insistence by some EU leaders that there can be no negotiations ahead of an article 50 notification.

Ultimately, the UK wants to retain access to the single market without accepting unlimited immigration. Free movement of goods, people, services and capital is permitted within the European Economic Area which – in addition to the EU – includes Norway and three other members of the European Free Trade Association (EFTA).

Rejoining EFTA would come at a price – and not just a financial contribution to the EU. There would continue to be free movement of people from EU states. But that is not unlimited: the agreement setting up the European Economic Area allows so-called safeguard measures to be taken by a member state if there are ‘serious economic, societal or environmental difficulties’. The precise scope of these safeguards is something that the UK would want to establish in negotiations.

In time, then, we may come to terms with leaving the EU. Before long, the Norwegian model may look surprisingly attractive. And, like the fabled dead parrot, we must stop pining for the lost fjords.