By Ingrid Melander

PARIS (Reuters) - For months, his main rival, Alain Juppe, was all the rage while he was dubbed "the Napoleon of supermarkets" by a left-wing news magazine as he toured malls signing copies of his book.

But now former president Nicolas Sarkozy has crept back into contention to become the conservative candidate in France's 2017 presidential election, overtaking Juppe among core supporters of their Les Republicains party.

The abrasive 61-year-old, who lost his re-election bid to Socialist Francois Hollande in 2012 after disenchanting both free-market reformers and leftists during his five-year term, is still less popular than Juppe among all center-right voters but the gap has narrowed.

For Sarkozy's closest supporters, his improved ratings have much to do with his track record as a strong-willed statesman at a difficult time for Europe - with the refugee crisis and Britain's vote to leave the European Union.

"More and more voters think he has the experience required to face the crisis we are going through now," said LR lawmaker Daniel Fasquelle, who also cited Sarkozy's "energy".

The former head of state, who has yet to formally declare his candidacy, is set to keep playing the experience card as the campaign for the November primaries heats up. But legal troubles and his own outsize personality could yet trip him up.

Once nicknamed the "hyper-president" for his kinetic style, Sarkozy claims credit for helping France and the euro zone through the global financial crisis.

But he disappointed the business community by under-achieving on reforms to revive the economy, except for a two-year increase in the official retirement age to 62.

His flashy lifestyle also antagonized many voters. While in office, he divorced his second wife, then publicly courted and married singer and former supermodel Carla Bruni, flaunting his taste for luxury yachts and expensive watches.

"It's very open," Francois Miquet-Marty of Viavoice pollsters said of the first primaries open to non-party members to select a candidate of the center-right.

"What's new is that Nicolas Sarkozy has managed to shift the lines, to get people to think he could actually win," Miquet-Marty said.

IDENTITY POLITICS

After difficult months following disappointing December regional elections, and a Juppe media blitz that saw the former prime minister on the cover of hipster magazines, Sarkozy has been more vocal than his rival in the past few weeks on issues including reforming the EU and protests against labor reforms.

He has also scored points by recruiting Francois Baroin, a moderate LR politician who can help soften his image.

At the same time, Sarkozy has returned to his signature theme of defending France's national identity in speeches aimed at winning back grassroots supporters tempted by far-right National Front leader Marine Le Pen, in a way Juppe cannot.

His message is an appeal to voters who think Islam is making worrying inroads into France's secular society.

The strategy has had some success, according to opinion polls over the past two weeks showing a growing lead for Sarkozy among LR sympathizers and a narrowing gap behind Juppe among center-right voters overall.

There are more than a dozen declared contenders for the primaries, but most are seen largely as trying to secure a media platform, and a cabinet job or patronage for their supporters from the eventual winner.

Sarkozy, who returned as party leader to halt an internal war at the end of 2014 after a two-year pause from politics, has seen his ratings among LR sympathizers jump from 48 to 65 percent in a month, a TNS Sofres poll showed. Juppe has lost pole position, with his rating down 14 points to 52 percent.

Juppe's campaign director, Gilles Boyer, acknowledged "a natural re-balancing" between the two top candidates.

"We had reached very high ratings, including in (Sarkozy's) core audience. He's re-building part of his base," Boyer told Reuters. "But we're still in a leadership position - one that is fragile of course, but enviable."

There is also a class divide. An Ipsos-Cevipof poll showed that, among voters certain to take part in the primaries, Juppe is doing much better among managers and pensioners, while Sarkozy is well ahead with employees and blue-collar workers.

"It's better to be ahead among those who tend to vote more," Boyer said.

SCARY?

In the last week of August, Sarkozy is expected to announce his candidacy and Juppe plans a big rally near Paris.

By early September the short-list of perhaps six candidates will be known. Lesser-known hopefuls are unlikely to gather enough nominating signatures from lawmakers and local elected officials to run.

Three televised debates will precede the two-round vote on Nov. 20 and 27, in which any eligible voter willing to part with 2 euros ($2.22) and sign a pledge that they agree with "the values of the right and the center" can take part.

With both Juppe and Sarkozy campaigning on similar platforms of lower taxes and a smaller state, the campaign will focus on personality and values, as well as credibility. Sarkozy, elected in 2007 on promises to radically overhaul France, says he regrets not having carried out more reforms.

Boyer insists Juppe won't change his more centrist stance on issues like immigration or his soft-spoken, less aggressive personality.

Some people close to Hollande say privately he would rather face Sarkozy than Juppe in the first round of the presidential election next April because the Socialist incumbent would have a better chance of reaching the run-off in May, likely to be against Le Pen.

"Sarkozy is very polarizing. Juppe does not scare away left-wing voters while Sarkozy does," one Socialist minister said on condition of anonymity. "That's why Sarkozy is a better choice (of opponent) as far as the left is concerned."

Dogged by judicial investigations into party financing and overspending by his 2012 presidential campaign, in which he denies any wrongdoing, Sarkozy still faces numerous hurdles.

"Sarkozy's ratings have improved among core supporters but there is still very strong opposition to him among other voters, and that helps Juppe," said Frederic Dabi of Ifop pollsters.

($1 = 0.9007 euros)

(Reporting by Ingrid Melander; Editing by Paul Taylor)