James McNels hands out copies of the Evening Standard newspaper to London commuters. (Shannon Jensen Wedgwood/For the Washington Post)

Elites are in trouble. High levels of immigration are destabilizing our democracies. Politicians who put their short-term political interests over their countries’ needs reap the whirlwind — for themselves but, more importantly, for their nations.

Citizens who live in the economically ailing peripheries of wealthy nations are in revolt against well-off and cosmopolitan metropolitan areas. Older voters lock in decisions that young voters reject. Traditional political parties on the left and right are being torn asunder.

One of the few good things about Britain’s vote to leave the European Union is the rich curriculum of lessons it offers leaders and electorates in other democracies.

History is unlikely to be kind to British Prime Minister David Cameron. Last week’s referendum was not the product of broad popular demand. Cameron called it to solve a short-term political problem and get through an election. His Conservative Party was split on Europe and feared hemorrhaging votes to the right-wing, anti-Europe, anti-immigrant U.K. Independence Party (UKIP).

Cameron figured that kicking his troubles down the road by promising a future plebiscite on Europe could make them go away. Instead, he turned a normal electoral challenge into a profound crisis that could lead to the breakup of his country while threatening Europe’s future. The devastating complaint of Martin Schulz, the president of the European Parliament: “A whole continent is taken hostage because of an internal fight in the Tory party.”

In a stunning victory for the "Leave" campaign, Britain has voted to exit the European Union. Here's what happens next. (Jason Aldag,Adam Taylor/The Washington Post)

For all the Union Jacks hoisted at Leave rallies, the nationalism behind this was English, not British. England voted to get out of the E.U., Scotland overwhelmingly to stay. Northern Ireland also favored Remain, while Wales split narrowly for Leave, its more English parts voting like England.

Suddenly, for Scots who want their country to be independent, their nationalism becomes a form of pro-European internationalism. To stay in Europe, they have to escape Britain. After a difficult but successful struggle for peace, Northern Ireland’s status is now also in doubt.

Don’t trash democracy or the voters. Where complicated choices are involved — and Brexit defines complexity — leaders in representative democracies need the guts to make hard calls and submit themselves to voters afterward. They should not use referendums purely to evade responsibility.

In fact, now that this road has been opened, real democrats should demand a second referendum on the terms of an exit deal. On Thursday, voters bet that the unknown would be better than the known. They should get to vote again on the full implications of what they set in motion.

The European idea was killed in part by right-wing Tories who think they can turn their island into a free-trade, low-regulation paradise. But it was also battered in traditionally Labour-voting industrial areas far away from a happy and generally prosperous London that voted overwhelmingly to stay. A partial tally of the discontent: 68 percent Leave in Barnsley, 70 percent in the authority that includes Grimsby , and 62 percent in South Shields’ borough.

Emma Lewell-Buck, the Labour parliamentarian who represents South Shields and supported Remain, was right to say that UKIP leader Nigel Farage “whipped everyone up into a frenzy with his hateful language.”

Ethno-nationalism is on the rise across Europe, and this vote will only intensify the trend. But in so many nations, including our own, technological change, globalization and financialization force the left-out to stare at prosperity from a great distance. In their justified frustration, they often see immigration as of a piece with the other changes in the world that they deplore.

: Britons react to cutting ties with the European Union: Many celebrated the referendum results Friday, and British Prime Minister David Cameron announced that he will resign after Britons went to the polls the day before. ( / )

Responsible officials should always be ready to denounce racism. But their job description also requires them to provide realistic policy answers to quell the rage. If center-right and center-left politicians fail to do this, their parties will remain suspect.

Yet if Britain’s vote is understandable, it’s also a cause for sadness. It’s a vote against a more open world and a rejection of the idea that democracies can actually gain power by pooling sovereignty and seeking goals in common.

The Leave campaign used slogans very familiar to Americans, including variations on “Take Our Country Back” and “Britain First.” These resonated with older voters who backed Leave by big margins. Younger Britons, who voted strongly to stay in Europe, will be shackled for many years to a result that their elders imposed on them.

Friends of open societies have been slapped in the face by citizens who are themselves retaliating for having been knocked around and ignored for too long. Across Europe and in the United States, politicians can either respond to these cries of protest or face something worse than Brexit.

Read more from E.J. Dionne’s archive, follow him on Twitter or subscribe to his updates on Facebook.