Many Britons went to bed last night thinking that their country’s membership of the EU was secure. They awoke this morning to hear UKIP leader Nigel Farage declare ‘independence day’ after 52% of voters chose to leave the EU.

Shock seems to be the prevailing mood among politicos, but the referendum result is not entirely unexpected. Opinion polls were too close to call in advance of yesterday’s vote even after, what appeared to be, a late surge for the Remain side. Bookies were even more optimistic about the chances of a vote for Remain but they have now joined the ranks of discredited elites in this country.

EU referendums are always difficult to win, as evidenced by ‘no’ votes against the Maastricht, Nice and Lisbon Treaties and the European Constitution. Winning an EU referendum in Britain was never going to be easy given the country’s fractious form on Europe. Asking a high-stakes question about membership rather than the ratification of a treaty made little difference in the end.

Prime Minister David Cameron knew these risks when he committed himself to a referendum in January 2013 but he judged the rewards to be worth it. With Conservative backbenchers spoiling for a fight on Europe and UKIP surging in the polls, the referendum pledge bought Cameron time and, so it seemed until he resigned earlier today, a second full term in Number 10.

A dynamic campaign in support of Remain might have helped to mitigate these risks but it failed to materialise. Although EU supporters won the economic argument, they failed to address people’s legitimate concerns about how the EU was governed. This left room for Leave’s rallying cry to ‘take back control’ from Brussels, a powerful political slogan that trumped dire economic predictions about the consequences of Brexit.

The UK’s fragmented political parties were another complicating factor in the referendum campaign. That the Conservatives would implode over Europe was always a possibility. Implode they did when Michael Gove and Boris Johnson joined the Leave campaign, allowing the less politically palatable Nigel Farage to stay behind the scenes.

None in 2013 would have predicted that Labour would move to the left and elect Jeremy Corbyn, a leader with little love for Europe. Labour MPs Alan Johnson and Chuka Umunna, among others, made a strong case for EU membership. However, their efforts were undermined by a leader who, when asked to put his passion for Europe on a scale of 1 to 10, replied: ‘seven, or seven and a half’.

Whatever the reasons for the referendum result, and it will take time for the evidence to emerge, Europe has entered a period of profound political uncertainty. All eyes are now on next week’s European Council to see how EU heads of state or government manage the political process set in motion by UK voters. Expect this process to play out over years rather than weeks or months.

The UK will be central to this process but not the sole focus. EU leaders will be concerned too about member states, such as the Netherlands, which are weighing up referendums of their own. Greece too will be closely watched for signs that Brexit might renew risks of Grexit. The euro crisis has demonstrated EU leaders’ ability to do deals during moments of high political drama. Such diplomatic skills are now needed more than ever.

The EU has been deeply damaged by the UK referendum, but crises are endemic to a political project as experimental as European integration. While no member state has ever left the EU, the Union has encountered a succession of constitutional crises since the 1950s. The EU has not always handled these crises well but it has developed a standard operating procedure in such situations based on intensive intergovernmental diplomacy between heads of state or government. This deliberative intergovernmentalism now faces a major new challenge.

The UK faces constitutional turmoil of its own – after a majority in Northern Ireland, London and Scotland voted to stay in the EU – but it lacks comparable operating procedures. Within minutes of the referendum result, Northern Ireland’s Deputy First Minister Martin McGuinness called for a referendum on Irish unification, confirming that fears about Brexit and the peace process were not devised by ‘project fear’. Scotland’s First Minister Nicola Sturgeon soon followed with a statement that a second referendum on Scottish independence is now ‘highly likely’.

Intergovernmentalism within the UK is considerably less developed than it is in the EU. David Cameron promised to include the leaders of Wales, Scotland and Northern Ireland in Brexit negotiations but he said little about how this might work. There is quite simply no template to tackle deep regional divisions in a political system that, in spite of devolution, remains highly centralized.

Dr Dermot Hodson is Reader in Political Economy at Birkbeck.