PARIS — Centrist newcomer Emmanuel Macron and far-right leader Marine Le Pen will contest a runoff vote for the French presidency on May 7 after coming first and second respectively in the election's first round on Sunday.

The duel will present France with a stark choice — between Macron's liberal, pro-EU platform and Le Pen's nationalist vision, which would include a crackdown on immigration and a rejection of European integration. Macron is the clear favorite to clinch the presidency in the runoff — an opinion poll on Sunday night predicted he would win by 62 to 38 percent.

"I want to be your president in two weeks' time — the president of all the people of France, the president of the patriots against the threat of the nationalists," Macron, 39, told supporters at a rally in Paris after the results became clear. "In your name, I will take into the second round the optimism that we need and follow the path of hope that we want for our country and for Europe."

At a rally in northern France, Le Pen, 48, told supporters: “The choice now is between wild globalization, a world in which terrorists can travel freely, and a France with strong borders."

She said: “It is time to free the French people from the arrogant elite. I am the candidate of the people. I call all patriots wherever they come from, whatever their origin, to join me. What’s at stake is France’s survival.”

The first-round result represented a huge failure for France's traditional major parties, the Socialists and the conservative Les Républicains, as neither of their candidates qualified for the second round. Senior figures from both big parties called on their supporters to unite behind Macron to ensure Le Pen's National Front is defeated.

With all votes now counted, Macron — a former economy minister who formed his own independent political movement last year — won 24.01 percent. Le Pen had 21.30 percent, with conservative former Prime Minister François Fillon on 20.01 percent and far-left candidate Jean-Luc Mélenchon on 19.58 percent. Socialist Party candidate Benoît Hamon came a distant fifth on 6.36 percent.

Fillon had been favorite to be France's next president before he was hit by allegations he funneled public cash to his wife and children by hiring them for parliamentary work they did not do. At a gathering of his supporters in Paris, he assumed responsibility for his defeat and called on them to support Macron.

“There is no other choice but to vote against the National Front,” he said. “I will vote in favor of Emmanuel Macron.”

Socialist Hamon issued a similar appeal. "I call for a fight against the National Front and call for a vote for Emanuel Macron," he said.

Either Macron or Le Pen will succeed deeply unpopular socialist President François Hollande, who decided not to run for another term.

Pollsters proved right

Final opinion polls published two days before the first round had suggested support for both Macron and Le Pen was at around 22 to 24 percent, with Fillon and Mélenchon just a few points behind.

However, the end of the election campaign was overshadowed by the fatal shooting of a police officer on the Champs Elysées on Thursday night which appeared to be the latest in a string of attacks by Islamic terrorists in France in recent years.

Sunday’s result was a stunning achievement for Macron, a former civil servant and investment banker who was virtually unknown to the public until he was appointed economy minister in 2014. He quit the post last August after forming his political movement, En Marche.

Macron has pledged to give new energy to the European project following Britain’s vote last year to leave the bloc. His has also promised fiscal discipline in line with Eurozone rules, partly in the hope of convincing Germany to agree to a common investment budget and joint finance minister for the zone.

The euro rose against the U.S. dollar on the news that Macron was now in pole position to become France's next president and mainstream Continental leaders including European Commission President Jean-Claude Juncker congratulated him on his win.

Le Pen’s score is the best ever result for her National Front party in a presidential election, beating the 17.9 percent of the vote she won in 2012. This will be the second time the National Front has made it to a presidential runoff; Le Pen’s father, Jean-Marie Le Pen, staged an upset in the first round in 2002 but was heavily defeated by Jacques Chirac in the runoff.

Le Pen proposes renegotiating France’s relationship with the EU to give Paris far greater control over borders and economic policy. Le Pen would call a referendum on France’s membership of the EU after concluding talks with Brussels and would back withdrawal from the bloc if — as seems almost certain — she did not get the changes she wanted.

Marion Solletty and Carmen Paun in Brussels contributed to this article, which has been updated with final results.