On the surface, the June 23 Brexit and the June 26 Spanish elections don’t look comparable.

After a nasty campaign filled with racism and Islamophobia, the British — or rather, the English and the Welsh — took a leap into darkness and voted to leave the European Union. Spanish voters, on the other hand, rejected change and backed a center-right party that embodies the policies of the Brussels-based trade organization.

But deep down the fault lines in both countries converge.

For the first time since Margaret Thatcher and Ronald Reagan rolled out a variety of neoliberal capitalism and globalization that captured much of the world in the 1980s, that model is under siege. The economic strategy of regressive taxes, widespread privatization, and deregulation has generated enormous wealth for the few, but growing impoverishment for the many. The top 1 percent now owns more than 50 percent of the world’s wealth.

The British election may have focused on immigration and the fear of “the other” — Turks, Syrians, Greeks, Poles, etc. — but this xenophobia stems from the anger and despair of people who have been marginalized or left behind by the globalization of the labor force that has systematically hollowed out small communities and destroyed decent paying jobs and benefits.

“Great Britain’s citizens haven’t been losing control of their fate to the EU,” wrote Richard Eskow of the Campaign for America’s Future. “They’ve have been losing it because their own country’s leaders — as well as those of most Western democracies — are increasingly in thrall to corporate and financial interests.”

While most of the mainstream media reported the Spanish election as a “victory” for acting Prime Minister Mariano Rajoy’s conservative People’s Party and defeat for the left, it was more a reshuffle than a major turn to the right. If Rajoy manages to cobble together a government, it is likely to be fragile and short lived.

The Shadow of Brexit

It was a dark couple of nights for pollsters in both countries.

British polls predicted a narrow defeat for the Brexit, and Spanish polls projected a major breakthrough for Spain’s left — in particular Unidos Podemos (UP), a new alliance between Podemos and the Communist/Green United Left bloc.

Instead, the Brexit passed easily and the UP lost 1 million votes from the last election, ending up with the same number of seats they had in the old parliament. In contrast, the People’s Party added 14 seats, although it fell well short of a majority.

A major reason for the Spanish outcome was the Brexit, which roiled markets all over the world but had a particularly dramatic effect on Spain. The Ibex share index plunged more than 12 percent and blue-chip stocks took a pounding, losing about $70 billion. It was, according to Spain’s largest business newspaper, “the worst session ever.” Rajoy — as well as the center-left Socialist Party — flooded the media with scare talk about stability, and it partly worked.

The Popular Party poached eight of its 14 new seats from the center-right Ciudadanos Party and probably convinced some potential Podemos voters to shift to the mainstream Socialists. But Rajoy’s claim that “We won the election. We demand the right to govern” is a reach. His party has 137 seats, and it needs 176 seats to reach a majority in the 350-seat parliament.

The prime minister says he plans to join with Ciudadanos. But because the latter lost seats in the election, such an alliance would put Rajoy seven votes short. An offer for a “grand alliance” with the Socialists doesn’t seem to be going anywhere either. “We are not going to support Rajoy’s investiture or abstain,” said Socialist Party spokesman Antonio Hernando.

Which doesn’t mean Rajoy can’t form a government. There are some independent deputies from the Basque country and the Canary Islands who might put Rajoy over the top, but it would be the first coalition government in Spain — and a fragile one at that.

Austerity on the Horizon

Part of that fragility is a scandal over an email between Rajoy and Jean-Claude Juncker, head of the European Commission, that was leaked to the media. The Commission is part of the “troika” with the International Monetary Fund and the European Central Bank that largely decides economic policy in the EU.

During the election, Rajoy promised to cut taxes and moderate the troika-imposed austerity measures that have driven Spain’s national unemployment rate to 22 percent, and a catastrophic 45 percent among young people. But in a confidential email to Juncker, the prime minister pledged, “In the second half of 2016, once there is a new government, we will be ready to take further measures to meet deficit goals.”

In short, Rajoy lied to the voters. If his party had won an absolute majority, that might not be a problem, but a coalition government is another matter. Would Ciudadanos and the independents be willing to associate themselves with such deceit and take the risk that the electorate would not punish them, given that such a government is not likely to last four years?

Unidos Podemos supporters were deeply disappointed in the outcome, although the UP took the bulk of the youth vote and triumphed in Catalonia, Spain’s wealthiest province, and the Basque country. What impact UP’s poor showing will have on divisions within the alliance isn’t clear, but predictions of the organization’s demise are premature. “We represent the future,” party leader Pablo Iglesia said after the vote.

There is a possible path to power for the left, although it leads through the Socialist Party. The SP dropped from 90 seats to 85 for its worst showing in history, but if it joins with the UP it would control 156 seats. If such a coalition includes the Catalans that would bring it to 173 seats, and the alliance could probably pick up some independents to make a majority. This is exactly what the left, agreeing to shelve their differences for the time being, did in Portugal after the last election.

The problem is that the SP refuses to break bread with the Catalans because separatists dominate the province’s delegation and the Socialist Party opposes letting Catalonia hold a referendum on independence. Podemos also opposes Catalan separatism, but it supports the right of the Catalans to vote on the issue.

Europe’s House Divided

Rajoy may construct a government, but it will be one that supports the dead-end austerity policies that have encumbered most of the EU’s members with low or flat growth rates, high unemployment, and widening economic inequality. Support for the EU is at an all time low, even in the organization’s core members, France and Germany.

The crisis generated by the free market model is hardly restricted to Europe. Here in the United States, much of Donald Trump’s support comes from the same disaffected cohort that drove the Brexit. And while “The Donald” is down in the polls, so were the Brexit and the Spanish People’s Party.

The next few years will be filled with opportunity, as well as danger. Anti-austerity forces in Spain, Italy, Greece, Portugal, and Ireland are organizing and beginning to coordinate resistance to the troika. But so too are parties on the far right: France’s National Front, Hungary’s Jobbik, Greece’s Golden Dawn, Britain’s United Kingdom Independence Party, Austria’s Freedom Party, Denmark’s People’s Party, and the Sweden Democrats.

Instead of reconsidering the policies that have spread so much misery through the continent, European elites were quick to blame “stupid” and “racist” voters for the Brexit. “We are witnessing the implosion of the postwar cultural and economic order that has dominated the Euro-American zone for more than six decades,” writes Andrew O’Helir of Salon. “Closing our eyes and hoping that it will go away is not likely to be successful.”

A majority of Britain said “enough,” and while the Spanish right scared voters into backing away from a major course change, those voters will soon discover that what is in store for them is yet more austerity.

“We need to end austerity to end this disaffection and this existential crisis of the European project,” said a UP statement following the election. “We need to democratize decision making, guarantee social rights, and respect human rights.”

The European Union is now officially a house divided. It is not clear how long it can stand.