President Nicolas Sarkozy, running from behind for a second term, has veered sharply to the right in the final days before Sunday’s runoff in the French presidential election, increasingly appealing to nationalism and anti-immigrant sentiment to gain support from the far-right National Front.

Francois Hollande, the moderate Socialist with a clear lead in opinion polls, condemned Sarkozy’s tactics as unworthy of French politics and a sign of desperation from a president who fears he is headed for defeat after only one term in office. But he also expressed understanding of the 18 percent of first-round voters who backed the National Front candidate, Marine Le Pen, and he emphasized a need to respond to their complaints that conventional politics has passed them by.

The controversy over appeals to the anti-immigrant right has largely eclipsed issues such as unemployment, the European ­financial crisis and declining standards of living, which, according to opinion polls, top the list of concerns among French voters. In the age of 24-hour news cycles and tweeted slogans, the campaign seemed in its final days to revolve around personalities and social tensions, such as the preservation of what Sarkozy called France’s “Christian roots” in a time of heavy Muslim immigration.

“We have taken in too many people, which has paralyzed our system of integration,” Sarkozy said in a head-to-head debate with Hollande that lasted nearly three hours Wednesday evening. “We must put a limit on the number of immigrants.”

In the wide-ranging debate, Sarkozy reiterated his pledge to cut legal immigration by half, down from about 180,000 a year, if he is reelected. Hollande’s proposal to allow noncitizens to vote in local elections, he added, would only add to an “extravagant rise in communal tensions” caused by the influx of Muslim residents.

The social tensions have combined with economic strains, particularly unemployment, to boost the rolls of far-right movements across Europe in recent months as governments are forced to impose austerity measures to bring down dangerously high deficits and public debt. Although hit with less force than such neighbors as Spain and Italy, France has seen unemployment rise to nearly 10 percent, undermining working-class families and producing resentment among voters that plays easily into the National Front’s anti-immigrant nationalism.

The attention focused on right-wing voters reflected Sarkozy’s imperative to capture a high percentage of their ballots Sunday if he is to overcome Hollande’s lead, which opinion polls put at about 53 percent to 47 percent. The business-oriented conservative won almost 70 percent of Le Pen’s voters in sailing to victory in the 2007 election, analysts noted, but he would have to do even better this time if he is to eke out a win.

“That has always been his equation,” said Thierry Vedel, a researcher at the prestigious Political Studies Institute in Paris.

Alain-Gerard Slama, a pro-Sarkozy columnist in Le Figaro newspaper, noted Wednesday that Sarkozy’s challenge is that he must persuade National Front voters to back him in the runoff without alienating centrist voters, who numbered about 9 percent in the April 22 first round. “The route is clearly narrow, but it’s the only one,” Slama wrote. “This is the bet that, in the final lap, his talent should permit him to win.”

Despite Sarkozy’s rightward swing, however, Le Pen refused to endorse him, saying in a May Day speech that the incumbent and Hollande were cut from the same cloth, taking orders from European Union bureaucrats and international bankers. National Front voters are free to make their own choice Sunday, she said, but she promised that her ballot would be blank.

Defense Minister Gerard Longuet said Le Pen has become a legitimate interlocutor for Sarkozy’s majority since she replaced her bombastic father as National Front leader. Longuet’s suggestion, in an interview with the extreme-right weekly Minute, was understood as a proposal for an anti-Socialist front in legislative elections scheduled for June.

The idea produced a howl of outrage from some of Sarkozy’s supporters as well as Hollande’s. Former prime minister Jean-Pierre Raffarin, a Sarkozy backer, called Longuet’s declaration “regrettable on the substance and inopportune on the form,” and Sarkozy’s party, the Union for a Popular Movement, said such a front would never be contemplated.

The Socialist candidate called on Sarkozy to dismiss Longuet to dissociate himself from the suggestion. The minister issued a clarification seeking to play down his comments. Sarkozy did not fire him.

A recent opinion poll showed a majority of French voters consider the National Front a danger to democracy because of its radical stands. In its program, the party called for a withdrawal from the euro, a drastic reduction in immigration and an automatic preference for French citizens seeking employment.

In addition, Sarkozy’s move to the right has come at the expense of consistency on a number of points. At the beginning of his campaign, for instance, he advocated “convergence” with Germany to improve the French economy. But in a speech this week, he declared that France must protect its national identity and said that enforcing territorial and cultural borders was a central campaign issue.

“He has changed his opinion on almost everything,” Vedel said. “It’s pretty astonishing.”

Philippe Labro, a veteran commentator, compared the campaign’s final days to a boxing match. In an essay in Le Figaro, he said Sarkozy knows he is behind on points but keeps punching away in hope of scoring what he knows is an unlikely last-minute knockout.