On June 23, British voters went to the polls to decide whether the UK will remain a member of the EU, and, against expectations, a comfortable majority voted to leave the bloc. Although polls indicated that the result would be close, market behavior ahead of the vote indicated that investors were betting on a pro-EU verdict, and the lack of preparedness on the part of leading advocates of “Brexit” to explain how they intended to proceed suggested that even they were caught off guard by their victory.

On the domestic front, the immediate impact will be mostly political, as the UK has maintained its own currency and opted out of the fiscal treaty adopted by the EU in 2012. The process of negotiating the terms of the UK’s relationship with the EU as a non-member will take two years, and will not formally commence until the British government invokes Article 50 of the Lisbon Treaty, which officials in London have indicated will not happen until a new government is in place.

That awaits the outcome of a Conservative Party leadership election planned for October, which has itself been thrown into uncertainty by Boris Johnson’s unexpected announcement that he will not compete for the post. The former mayor of London was one of the public faces of the Leave campaign and the presumed favorite to replace Cameron, but his chances of winning a party contest evaporated when his key party ally, Michael Gove, announced his own bid for the leadership crown.

Gove, who prior to putting the knife in Johnson’s back had repeatedly declared that he was not prepared to serve as prime minister, will battle with Theresa May, a member of the Stay camp who has nevertheless pledged to act in accordance with the popular will, and three dark-horse candidates. The latest developments point to the potential for a bitter campaign that could widen factional rifts within the party, possibly to an extent that endangers the new prime minister’s majority in the Parliament.

Moreover, the very strong pro-EU vote in Scotland all but ensures that the regional government headed by the SNP will push for another independence referendum, while similarly robust support for the EU in Northern Ireland has already sparked debate about Irish reunification, raising concerns that the peace that has prevailed for nearly 20 years could be jeopardized as a result.

There are also economic risks for the UK. Although there is no danger of a stampede of businesses rushing to leave the country, there is a risk of a sharp fall in investment and sizeable layoffs as companies, particularly those in the financial sector, weigh the merits of maintaining or expanding their operations in a country whose access to the EU market is shrouded in uncertainty.

Perhaps the bigger concern for investors is the negative impact that Brexit could have on the stability of the EU. Euroskeptic parties across the continent will attempt to broaden their popular appeal by promising to hold in-or-out referendums on EU membership if elected, and some mainstream parties may feel compelled to match the offer in order to fend off a challenge from parties at the poles of the political spectrum. Thus, it is possible that several referendums might be held, regardless of which parties control the government, in which case the outcome cannot be taken for granted.

Under the circumstances, the EU would seem to have a strong incentive to diminish the appeal of leaving the bloc by making the UK’s exit as painful as possible. However, making the terms of departure too onerous could hurt Britain’s trade partners on the continent, resulting in further economic setbacks that might only serve to reinforce European voters’ hostility toward the EU.

The outlook is made even murkier by the (admittedly slim) possibility that the UK might actually remain in the EU. Barely two days after the referendum, more than 3 million people had reportedly signed an online petition demanding a do-over vote, and anecdotal evidence suggested that many voters did not fully understand the implications of leaving the EU.

If the process of choosing a replacement for Cameron sows disunity within the Conservative Party, the new prime minister may have no choice but to call a snap election in early 2017. In that event, the Labour Party and the SNP would almost certainly include a pledge to hold a second referendum in their campaign platforms, and, if victorious, the decision to leave the EU could be reversed. However, at this point, that is a very long shot, at best.