BRUSSELS -- The hardest-fought European Parliament election in decades drew toward a close Sunday with the anti-immigrant far right and the pro-environment Greens both projected to gain ground at the expense of the continent's longtime political centre.

The four days of balloting across the 28 European Union countries 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.

While pro-EU parties still were projected to win about two-thirds of the legislature, populist parties and the pro-environment Greens appeared headed for significant gains, according to projections released by the European Parliament.

Exit polls in France indicated that Marine Le Pen's far-right, anti-immigrant National Rally party came out on top in an astonishing rebuke of French President Emmanuel Macron, who has made EU integration the heart of his presidency.

Le Pen said the expected result "confirms the new nationalist-globalist division" in France and beyond.

Exit polls indicated the party of German Chancellor Angela Merkel and its centre-left coalition partner also suffered losses.

With the stakes high, turnout across the bloc -- not counting Britain, which is quitting the EU -- was put at a preliminary 51%, a 20-year high. An estimated 426 million people were eligible to vote in what was considered the most important European Parliament election in decades. Full results were expected overnight.

The balloting, which began Thursday, pitted supporters of closer unity against those who consider the EU a meddlesome and bureaucratic presence and want to return power to national governments and sharply restrict immigration.

Italy's Interior Minister Matteo Salvini, a major figure among the anti-migrant hard-line nationalists, said that he felt a "change in the air" and that a victory by his right-wing League party would "change everything in Europe."

Mainstream centre-right and centre-left parties were widely expected to hold on to power in the 751-seat legislature that sits in both Brussels and Strasbourg. But the result left the two main parties, the EPP and S&D, without a majority in the legislature, opening the way for complicated talks to form a workable majority. The Greens were jockeying to become decisive in the body.

Early projections Sunday suggested the Greens would secure 71 seats, up from 52 five years ago. The Greens appeared to have done well in France, Germany 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.

In Germany, the EU's biggest country, governing parties were predicted to lose ground while the Greens were set for big gains. The far right was also expected to pick up slightly more support.

Germany's Manfred Weber, the candidate of the European People's Party, currently the biggest in the legislature, said in Berlin that the elections appeared to have weakened the political centre.

He said 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 EU and its Parliament set trade policy on the continent, regulate agriculture, oversee antitrust enforcement and set monetary policy for 19 of the 28 nations sharing the euro currency.

Other countries voting on Sunday included Italy, Poland, Spain, Greece, Portugal, Denmark, Sweden, Austria, Belgium and Lithuania. Britain voted Thursday, taking part in the balloting even though it is planning to leave the EU. Its EU lawmakers will lose their jobs as soon as Brexit happens.

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.

Hungary's increasingly authoritarian prime minister Viktor Orban, a possible ally of Italy's Salvini, said he hopes the election will bring a shift toward political parties that want to stop migration. The migration issue "will reorganize the political spectrum in the European Union," he said.

Proponents of stronger EU integration, led by Macron, argue that issues like climate change and reining in immigration are simply too big for any one country to tackle alone.

Macron, whose country has been rocked in recent months by the populist yellow vest movement, had called the elections "the most important since 1979 because the Union is facing an existential risk" from nationalists seeking to divide the bloc.

With the elections over, European leaders will begin the task of selecting candidates for the top jobs in the EU's headquarters in Brussels. The leaders meet for a summit over dinner Tuesday. Current European lawmakers' terms end July 1, and the new parliament will be seated the following day.

------

Associated Press writers Raf Casert, Veselin Toshkov in Sofia, Bulgaria; Joseph Wilson in Barcelona, Spain; Pablo Gorondi in Budapest; Sylvie Corbet in Paris; Jill Lawless in London; and Geir Moulson in Berlin contributed to this report.