The European Union’s traditional center splintered as the far right and pro-environment Greens of the far left were gaining ground on Sunday after four days of a polarized vote in the hardest-fought European Parliament elections in decades.

Europe has been roiled in the past few years by immigration from the Mideast and Africa and deadly attacks by Islamic extremists. It has also seen rising tensions over economic inequality and growing hostility toward the political establishment — sentiments not unlike those that got Donald Trump elected in the U.S.

In France, an electorate that voted Emmanuel Macron into presidential office in 2017 did an about-face and the party of his defeated opponent, Marine Le Pen, drew into first place.

In Britain, voters went for the extremes, with the strongest showing for Nigel Farage’s the newly formed Brexit party and a surge for the staunchly pro-European Liberal Democrats, versus a near wipeout for Conservatives.

Turnout was at a two-decade high over the balloting across the 28 European Union countries. The elections were seen as a test of the influence of the nationalist, populist and hard-right movements that have swept the continent in recent years and impelled Britain to quit the EU altogether. Both supporters of closer European unity and those who consider the EU a meddlesome and bureaucratic presence portrayed the vote as crucial for the future of the bloc.

YELLOW VEST PROTEST IN BRUSSELS TURNS VIOLENT

In Germany, Chancellor Angela Merkel’s ruling coalition saw a drastic loss in support to the Greens and, to a lesser extent, the far right. Italy’s League party, led by Matteo Salvini, claimed 32 percent of the vote in early projections, compared with around 6 percent five years ago.

“Not only is the League the first party in Italy, but Marine Le Pen is first in France, Nigel Farage is first in Great Britain. Therefore, Italy, France and England: the sign of a Europe that is changing, that is fed up,” Salvini said.

Despite gains, the vote was hardly the watershed anticipated by Europe’s far-right populists, who have vowed to dilute the European Union from within in favor of national sovereignty. Pro-EU parties still were expected to win about two-thirds of the 751-seat legislature that sits in Brussels and Strasbourg, according to the projections released by the parliament and based on the results rolling in overnight.

The continent-wide voting had major implications not just for the functioning of the bloc but also for the internal politics in many countries. Le Pen exulted that the expected result “confirms the new nationalist-globalist division” in France and beyond; Greece’s governing party called for snap elections after its loss; and Salvini was expected to capitalize on the outcome to boost his power at home.

Le Pen’s far-right, anti-immigrant National Rally party came out on top in France with 24 percent in an astonishing rebuke of Macron, who has made EU integration the heart of his presidency. His party drew just over 21 percent, according to government results.

Exit polls in Germany, the EU’s biggest country, likewise indicated Merkel’s party and its center-left coalition partner also suffered losses, while the Greens were set for big gains and the far right was expected to pick up slightly more support.

Turnout across the bloc was put at 50.5 percent, a 20-year high. An estimated 426 million people were eligible to vote.

“The monopoly of power is broken,” Margrethe Vestager, of the pro-EU ALDE grouping that includes Macron’s party. Vestager declared herself a candidate to lead the European commission for ALDE, which gained seats in large part because Macron’s party is itself a newcomer.

The results will likely leave Parliament’s two main parties, the European People’s Party and the Socialists & Democrats, without a majority for the first time since 1979, opening the way for complicated talks to form a working coalition. The Greens and the ALDE free-market liberals were jockeying to become decisive in the body.

A subdued Esther de Lange, vice chair of the European People’s Party, conceded that the results indicate “fragmentation and a shrinking center.”

CLICK HERE TO DOWNLOAD THE FOX NEWS APP

The Greens did well not just in Germany but in France and Ireland. “The Green wave has really spread all over Europe, and for us that is a fantastic result,” said Ska Keller, the group’s co-leader in the Parliament.

Germany’s Manfred Weber, the candidate of the EPP, the biggest party in Parliament, said that now it is “most necessary for the forces that believe in this Europe, that want to lead this Europe to a good future, that have ambitions for this Europe” to work together.

The Associated Press contributed to this report.