The dust is just beginning to settle on Britain’s messy general election on Thursday, days before the country is to start complex negotiations on disentangling itself from the European Union. Theresa May’s future as prime minister and leader of the Conservative Party is openly in doubt, with Britain once again plunged into political turmoil.

It wasn’t supposed to be this way. The new prime minister inherited a sizable majority from David Cameron, who resigned the position last June after narrowly losing his bid to keep Britain in the European Union. May assured a campaign-weary nation that there was no need to call a general election — the slim majority (51.9 percent) voting in favor of leaving the EU gave her enough authority to begin the arduous process known as “Brexit.” Hoping to strengthen her majority and bargaining power, however, she reversed course and took a gamble on a new election.

OPINION

May promised “strong and stable” leadership, but ran a colorless, error-prone campaign. Her majority vanished overnight, followed by frantic efforts to shore up a minority government with Northern Ireland’s right-wing Democratic Unionist party.

Doubts have been raised by both the EU and May’s own Conservative Party over her ability to lead the negotiations and preside over a deal that will affect Britain and the EU for generations. She will almost certainly have to fend off strong leadership challenges precisely when she must settle such complex matters as the rights of EU citizens living in Britain, the renewal of a historically fraught 310-mile land border between Northern Ireland and the Republic of Ireland, and the politically unpopular Brexit “bill” for payment of budget contributions assured by her predecessor. Whether or not May will survive these challenges is uncertain.

The results of this latest election also raise larger questions about the nationalist populism that fueled Britain’s referendum on EU membership — a referendum that was profoundly divisive. It pitted urban voters against their rural counterparts, and younger, largely pro-European voters against some of their Euro-skeptic, anti-immigrant elders.

To a large degree, those tensions mirror comparable divisions and polarization in the U.S., both during and after last November’s presidential election. The fault lines of both countries are set by immigration, social and economic inequality, and a rejection of experts, elites, and the traditional two-party system in favor of outsiders, populism, and a desire to put nation first.

Thursday’s election in Britain suggests that voters are already having second thoughts about the consequences of embracing such nationalist populism, in ways that mirror the collapse of Trump’s and the GOP’s approval ratings in the U.S. In Britain, support for the outsider (and Russian-aided) UKIP or Independence Party buckled on Thursday; poorer voters returned in droves to the Labour Party, historically their strongest advocate. Meanwhile, voters of all stripes rebuked May’s belief that the slim referendum outcome authorized her push for a “hard” Brexit, perhaps even without a final deal with the EU. Compromises over trade and immigration are necessary if Britain is to retain access to a trading bloc representing almost 44 percent of its export market in goods and services.

In the U.S., a comparable rejection of extremism, isolationism, and polarization is harder to measure, beyond those dismal approval ratings. Though such moves will be easier to detect in the 2018 midterms, second thoughts among voters already are evident from the surge of support for Democratic candidates in special elections from Montana, Virginia and Tennessee to Georgia and South Carolina.

The GOP — like Britain’s Conservatives — will soon have to decide whether to double down on nationalism or reject it as parochial, xenophobic, and tribalist. In France, voters facing that stark choice opted for liberalism, pluralism, and the international order, and British voters now appear to have joined them.

It is too early to know whether the nationalist populism stoked by a resurgent Russia has peaked in the West, but if the recent elections in France and Britain are any guide, the isolationists who threw their lot in with the Trump administration and “America First” may soon face equally catastrophic losses.

Christopher Lane (www.christopherlane.org) teaches at Northwestern University and is the author most recently of Surge of Piety: Norman Vincent Peale and the Remaking of American Religious Life.