A man waves a flag as he attends a rally for “Britain Stronger in Europe,” the official “Remain” campaign group seeking to avoid Brexit, in London on June 19. (Ben Stansall/Agence France-Presse via Getty Images)

Imagine a young Margaret Thatcher, a politician who deeply mistrusts the political establishment and identifies on a gut level with the frustrations of the middle class. That’s shorthand for what Britain will need as it picks up the pieces after Thursday’s Brexit referendum.

Friends of Britain (and Europe, too) need to stop pretending that support for withdrawal from the European Union is simply a product of xenophobic right-wing nationalism. Nearly half the country supports a British exit, according to prereferendum polls, and these people are not all deluded reactionaries.

The European Union is unpopular in Britain for the same reason it is in many other parts of Europe: It’s seen as the project of a financial and political elite that often operates without regard for public opinion. Nationalism may be a tarnished, retrograde sentiment, but the fact remains that many people feel deeply attached to their countries.

This patriotic feeling can’t be expunged. But it should be modernized. And that’s where a modern Maggie could do wonders. Think of a restless, mildly rebellious British politician who could find common cause with like-minded Europeans who are tired of being lectured by Brussels.

Thatcher took a wrecking ball to an earlier generation of entrenched, elite opinion in Britain. When she became prime minister in 1979, Britain was still encased in a class system that maintained the conservative status quo at both ends — the power of the aristocratic Tory elite and the Labour Party trade-union bosses, who in tandem resisted any reforms that might challenge their power.

On June 23, Britain faces a fateful decision: whether or not to leave the European Union. And the world will be watching. (Daron Taylor,Jason Aldag,Danielle Kunitz/The Washington Post)

Thatcher, a grocer’s daughter, despised this status quo. She defied a bitter 1980s strike by the National Union of Mineworkers where previous prime ministers, Labour and Tory, had caved. She deregulated the financial sector, in what was called the Big Bang, restoring London to global primacy.

Britain in recent years has seemed to be slipping backward. David Cameron, the Conservative leader, is an Old Etonian who, in form and function, is a latter-day embodiment of the Tory elite. Labour leader Jeremy Corbyn, similarly, is a throwback to the left-wing, union-cosseted yesterday of his party.

The most hopeful aspect of the Brexit debate is that most young British people seem to be instinctively European. They have grown up in a global economy in which people move from job to job and country to country. A recent poll by ICM for the Guardian found that 56 percent of voters age 18 to 34 want to remain in the E.U., while just 39 percent favor leaving. By contrast, 55 percent of those over 65 favor withdrawal.

Other surveys make the same point: The older people get in Britain, the more they mistrust the E.U. That’s the biggest danger of the pro-Brexit campaign, beyond the economic damage it has risked. It would tie the country’s future to the oldest, most conservative cohort of its population.

The E.U. leadership in Brussels deserves its bad reputation. Lacking the instruments of real governance, the Eurocrats have nibbled around the edges with rules and regulations that imply a common destiny but leave to others the hard questions, such as border security and fiscal discipline.

Germany sits uneasily atop this shaky enterprise. The Germans are lucky to have a chancellor who, no matter how wealthy and privileged her country may be, still acts like the Lutheran pastor’s daughter who was raised in East Germany. Asked once what was distinctive about Germany, she gave this sturdy, if unlikely, answer: “No other country can build such airtight and beautiful windows.” Her power comes in part from her ability to appear ordinary.

Europe is only beginning its process of change. A senior German official told me a few months ago that the strange thing about the Brexit vote was that “the best case and the worst case are so close together.” What he meant was that Germany understands that Europe’s institutions must change, regardless of whether Britain is in or out.

E.U. purists may still dream of a tighter federalism, but that would involve a surrender of national power that nobody, least of all the Germans or French, really wants. What’s more likely is a core E.U. that runs at German speed and allows the periphery some of the leeway that Cameron won for Britain in the negotiation that preceded the wretched Brexit campaign.

Rather than crying crocodile tears for the old version of the E.U., modernizing politicians in Britain and on the continent should be thinking about change. It’s time for “Maggie redux.” Bring on the wrecking ball.

Read more from David Ignatius’s archive, follow him on Twitter or subscribe to his updates on Facebook.