President Emmanuel Macron and the hard-right leader Marine Le Pen will compete for a second time in a runoff on April 24.PARIS — President Emmanuel Macron will face Marine Le Pen, the French far-right leader, in the runoff of France’s presidential elections.With 92 percent of the ballots cast on Sunday counted, Mr. Macron, a centrist, was leading with about 27.4 percent of the vote to Ms. Le Pen’s 24.3 percent. Ms. Le Pen benefited from a late surge that reflected widespread disaffection over rising prices, security and immigration.With war raging in Ukraine and Western unity likely to be tested as the fighting continues, Ms. Le Pen’s strong performance demonstrated the enduring appeal of nationalist and xenophobic currents in Europe. Extreme parties of the right and left took some 51 percent of the vote, a clear sign of the extent of French anger and frustration.An anti-NATO and more pro-Russia France in the event of an ultimate Le Pen victory would cause deep concern in allied capitals, and could fracture the united trans-Atlantic response to the Russian invasion of Ukraine.But Mr. Macron, after a lackluster campaign, will go into the second round as the slight favorite, having fared a little better than the latest opinion polls suggested. Some had shown him leading Ms. Le Pen by just two points.Marine Le Pen speaking after the first-round results were announced on Sunday.Andrea Mantovani for The New York TimesThe principled French rejection of Ms. Le Pen’s brand of anti-immigrant nationalism has frayed as illiberal politics have spread in both Europe and the United States. She has successfully softened her packaging, if not her fierce conviction that French people must be privileged over foreigners and that the curtain must be drawn on France as a “land of immigration.”Ms. Le Pen’s ties to President Vladimir V. Putin of Russia are close, although she has scrambled in recent weeks to play them down. This month, she was quick to congratulate Viktor Orban, Hungary’s nationalist and anti-immigrant leader, on his fourth consecutive victory in parliamentary elections.“I will restore France to order in five years,” Ms. Le Pen declared to cheering supporters, appealing to all French people to join her in what she called “a choice of civilization” in which the “legitimate preponderance of French language and culture” would be guaranteed and full “sovereignty reestablished in all domains.”The choice confronting French people on April 24 was between “division, injustice and disorder” on the one hand, and the “rallying of French people around social justice and protection,” she said.Mr. Macron told flag-waving supporters: “I want a France in a strong Europe that maintains its alliances with the big democracies in order to defend itself, not a France that, outside Europe, would have as its only allies the populist and xenophobic International. That is not us.”He added: “Don’t deceive ourselves, nothing is decided, and the debate we will have in the next 15 days is decisive for our country and for Europe.”A polling station in Pontoise on Sunday.Andrea Mantovani for The New York TimesLast week, in an interview in the daily Le Parisien newspaper, Mr. Macron called Ms. Le Pen “a racist” of “great brutality.” Ms. Le Pen hit back, saying that the president’s remarks were “outrageous and aggressive.” She called favoring French people over foreigners “the only moral, legal and admissible policy.”The gloves will be off as they confront each other over the future of France, at a time when Britain’s exit from the European Union and the end of Angela Merkel’s long chancellorship in Germany have placed a particular onus on French leadership.Mr. Macron wants to transform Europe into a credible military power with “strategic autonomy.” Ms. Le Pen, whose party has received funding from a Russian and, more recently, a Hungarian bank, has other priorities.The runoff, on April 24, will be a repeat of the last election, in 2017, when Mr. Macron, then a relative newcomer to politics intent on shattering old divisions between left and right, trounced Ms. Le Pen with 66.9 percent of the vote to her 33.1 percent.The final result this time will almost certainly be much closer than five years ago. Polls taken before Sunday’s vote indicated Mr. Macron winning by just 52 percent to 48 percent against Ms. Le Pen in the second round. That could shift in the coming two weeks, when the candidates will debate for the first time in the campaign.Reflecting France’s drift to the right in recent years, no left-of-center candidate qualified for the runoff. The Socialist Party, long a pillar of postwar French politics, collapsed, leaving Jean-Luc Mélenchon, the far-left anti-NATO candidate with his France Unbowed movement, to take third place with about 21 percent.Supporters of Mr. Macron in Paris on Sunday.James Hill for The New York TimesMs. Le Pen, who leads the National Rally, formerly the National Front, was helped by the candidacy of Éric Zemmour, a fiercely xenophobic TV pundit turned politician, who became the go-to politician for anti-immigrant provocation, which made her look more mainstream and innocuous. In the end, Mr. Zemmour’s campaign faded, and he took about 7 percent of the vote.Mr. Zemmour immediately called on his supporters to back Ms. Le Pen in the second round. “Opposing Ms. Le Pen there is a man who allowed 2 million immigrants to enter France,” Mr. Zemmour declared.The threatening scenario for Mr. Macron is that Mr. Zemmour’s vote will go to Ms. Le Pen, and that she will be further bolstered by the wide section of the left that feels betrayed or just viscerally hostile toward the president, as well as by some center-right voters for whom immigration is the core issue.More than half of French people — supporters of Ms. Le Pen, Mr. Zemmour and Mr. Mélenchon — now appear to favor parties that are broadly anti-NATO, anti-American and hostile to the European Union. By contrast, the broad center — Mr. Macron’s La République en Marche party, the Socialist Party, the center right Republicans and the Green Party — took a combined total of about 40 percent.These were numbers that revealed the extent of anxiety in France, and perhaps also the extent of distrust of its democracy. They will be more comforting to Ms. Le Pen than to Mr. Macron, even if Mr. Mélenchon said his supporters should not give “a single vote” to Ms. Le Pen.He declined, however, to endorse Mr. Macron.At Ms. Le Pen’s headquarters, Frederic Sarmiento, an activist, said, “She will benefit from a big transfer of votes,” pointing to supporters of Mr. Zemmour, but also some on the left who, according to polls, will support Ms. Le Pen in the second round.Immigrant families awaiting emergency accommodation outside the Paris city hall last April.Andrea Mantovani for The New York Times“I am very worried, it will be a very close runoff,” said Nicolas Tenzer, an author who teaches political science at Sciences Po university. “Many on the left will abstain rather than vote Macron.”Mr. Macron gained the immediate support for the second round of the defeated Socialist, Communist, Green and center-right candidates, but between them they amounted to no more than 15 percent of the first-round vote. He may also benefit from a late surge in support of the Republic in a country with bitter wartime experience of extreme-right rule.In the end, the election on Sunday came down to Mr. Macron against the extreme right and left of the political spectrum, a sign of his effective dismantlement of the old political order. Now built essentially around a personality — the restless president — French democracy does not appear to have arrived at any sustainable alternative structure.If the two runoff qualifiers are the same as in 2017, they have been changed by circumstances. Where Mr. Macron represented reformist hope in 2017, he is now widely seen as a leader who drifted to the right and a top-down, highly personalized style of government. The sheen is off him.On the place of Islam in France, on immigration controls and on police powers, Mr. Macron has taken a hard line, judging that the election would be won or lost to his right.Addressing his supporters after the vote Sunday, he said he wants a France that “fights resolutely against Islamist separatism” — a term he uses to describe conservative or radical Muslims who reject French values like gender equality — but also a France that allows all believers to practice their faiths.A polling place at the Versailles town hall.Andrea Mantovani for The New York TimesHis rightward shift had a cost. The center-left, once the core of his support, felt betrayed. To what extent the left will vote for him in the second round will be a main source of concern, as already reflected in Mr. Macron’s abrupt recent catch-up paeans to “fraternity,” “solidarity” and equality of opportunity.Throughout the campaign, Mr. Macron appeared disengaged, taken up with countless telephone calls to Mr. Putin that proved ineffectual.A comfortable lead in polls disappeared in recent weeks as resentment grew over the president’s detachment. He had struggled during the five years of his presidency to overcome an image of aloofness, learning to reach out to more people, only to suffer an apparent relapse in the past several weeks.Still, Mr. Macron steered the country through the long coronavirus crisis, brought unemployment to its lowest level in a decade and lifted economic growth. Doing so, he has convinced many French people that he has what it takes to lead and to represent France with dignity on the world stage.Ms. Le Pen, who would be France’s first woman president, is also seen differently. Now in her third attempt to become president — Jacques Chirac won in 1995 after twice failing — she bowed to reason (and popular opinion) on two significant fronts: dropping her prior vows to take France out of the European Union and the eurozone. Still, many of her proposals — like barring E.U. citizens from some of the same social benefits as French citizens — would infringe fundamental European treaties.The leader of the National Rally, formerly the National Front, toned down her language to look more “presidential.” She smiled a lot, opening up about her personal struggles, and she gave the impression of being closer to the day-to-day concerns of French people, especially with regard to sharply rising gas prices and inflation.But many things did not change. Her program includes a plan to hold a referendum that would lead to a change in the Constitution that would ban any policies that lead to “the installation on national territory of a number of foreigners so large that it would change the composition and identity of the French people.”She also wants to bar Muslim women from wearing head scarves and fine them if they do.Polling booths in Trappes on Sunday. The first round of voting saw the highest abstention rate in decades.Andrea Mantovani for The New York TimesThe abstention rate Sunday, at between about 26 and 28 percent, was several points above the last election. Not since 2002 has it been so high.This appeared to reflect disillusionment with politics as a change agent, the ripple effect of the war in Ukraine and lost faith in democracy. It was part of the same anger that pushed so many French people toward political extremes.Aurelien Breeden More