In a stunning rebuke of basically the country's entire political establishment, Britain voted Thursday to leave the European Union. The pound crashed hard when the results were announced, and markets are tanking around the globe. Both Northern Ireland and Scotland voted to stay in the EU, and leaders in both places are considering an Irish reunion and an independent Scotland that could get back in the EU. Even Spain is eyeing Gibraltar. In a few years, England and Wales could be all that remains of the United Kingdom.

An immediate search for scapegoats has commenced. Prime Minister David Cameron, who promised the referendum as a sop to rightist factions so he could win the election in 2015, is the clearest culprit. The U.K. Independence Party and its leader Nigel Farage, who has already begun to admit selling the pro-Brexit campaign on a series of outright lies, is another.

However, the clearest lesson ought to be for the elites of the European Union. Farage and Cameron aside, Brexit undoubtedly would not have happened had the rest of Europe not been an utter basket case. If EU elites had any sense at all, they would seize this chance — perhaps their last one — to put European policy back in order.

EU policymaking has been disastrous in the extreme ever since the financial crisis. Instead of the standard-issue economic policy tools for dealing with a recession, the EU did the opposite — replaying the disaster of the 1930s with tight money and austerity. As a result, while the United States has gradually staggered to its feet, the eurozone (the part of Europe over which EU elites have the greatest direct control) has remained mired in a quasi-depression and mass unemployment.

It's true that the U.K. is not on the euro and that anti-immigrant animus was likely the greatest proximate force behind the Leave campaign. But imagine a counterfactual where the EU responded wisely to the Great Recession — dealing with the crisis as Europeans first, instead of returning to nationalist scapegoating. Imagine both creditors and debtors were bailed out (instead of the former only), and any demanded reforms to countries like Greece were coupled to enough loans and transfers to prevent mass unemployment. Indeed, the EU could easily be doing better than the U.S., given our mediocre at best recovery.

Britain surely would not have detached itself from a thriving and reasonably just EU. That the union is run in reality like a technocratic dictatorship whose leaders are equal parts vicious and incompetent has the opposite effect.

Global markets are panicking, because London is a large center of global finance and this could augur further political chaos down the road. But it might not turn out all that badly for Britain once the dust settles. As Dean Baker points out, Conservative Party austerity has depressed the British economy by something like 17 percentage points of 2007-era GDP — about three times worse than the probable worst-case scenario of Brexit. Cameron has promised to resign, and there are already calls for another general election. If the Labour Party (or someone else) were to win and implement a big spending program, the U.K. could easily end up better off overall.

That, in turn, would massively strengthen the hand of anti-EU formations within the eurozone, which are already riding high on the success of Brexit. France's Marine Le Pen is already calling for a referendum on French membership, as is the Netherlands' Geert Wilders. Leaving the euro would be a potential economic cataclysm for those countries, but good luck convincing voters of that.

Elite bungling has badly cracked the European Union. This may be the last chance to fix it before the breakup becomes irreversible. But if I had to guess, I would say a crackup is exactly what's going to happen, sooner or later.