The world is looking at Britain and asking: What on Earth just happened? Those who run Britain are asking the same question.

Never has there been a greater coalition of the establishment than that assembled by Prime Minister David Cameron for his referendum campaign to keep the U.K. in the European Union. There was almost every Westminster party leader, most of their troops and almost every trade union and employers’ federation. There were retired spy chiefs, historians, football clubs, national treasures like Stephen Hawking and divinities like Keira Knightley. And some global glamour too: President Barack Obama flew to London to do his bit, and Goldman Sachs opened its checkbook.

And none of it worked. The opinion polls barely moved over the course of the campaign, and 52% of Britons voted to leave the EU. That slender majority was probably the biggest slap in the face ever delivered to the British establishment in the history of universal suffrage.

Mr. Cameron announced that he would resign because he felt the country has taken a new direction—one that he disagrees with. If everyone else did the same, the House of Commons would be almost empty. Britain’s exit from the EU, or Brexit, was backed by barely a quarter of his government members and by not even a tenth of Labour politicians. It was a very British revolution.

Donald Trump’s arrival in Scotland on Friday to visit one of his golf courses was precisely the metaphor that the Brexiteers didn’t want. The presumptive Republican presidential nominee cheerily declared that the British had just “taken back their country” in the same way that he’s inviting Americans to do—underscoring one of the biggest misconceptions about the EU referendum campaign. Britain isn’t having a Trump moment, turning in on itself in a fit of protectionist and nativist pique. Rather, the vote for Brexit was about liberty and free trade—and about trying to manage globalization better than the EU has been doing from Brussels.