PARIS (Reuters) - He is rousing crowds at campaign rallies with fiery speeches warning of the dangers of immigration while losing ground in opinion polls - Nicolas Sarkozy's law-and-order platform pleases core supporters but is backfiring with French voters.

The combative former president began a re-election bid in late August, stealing much of the limelight from rivals as he tapped into voters' concerns over Islamist attacks and Europe's refugee crisis.

Six weeks later, and with six weeks to go before the primaries that will decide who gets the conservatives' ticket for the April 2017 presidential election, opinion polls show him losing support with voters overall and among supporters of his Les Republicains party.

"It's paradoxical because his strategy of veering to the right is in line with how French society is evolving and it should work, but it doesn't," said Francois Miquet-Marty of Viavoice pollsters.

There are two main reasons. One is the law-and-order strategy itself, which alienates moderates without necessarily convincing hardliners tempted by far-right National Front (FN) chief Marine Le Pen. The other is the 61-year-old's abrasive personality, the fact that he has been in power before and the judicial investigations targeting him.

French presidential candidates often first adopt partisan positions aimed at binding in grass roots supporters before moving to more middle of the road positions later on. But several polls show this time Sarkozy is losing ground even among party sympathizers, who favor the more moderate former prime minister Alain Juppe.

NOT THE FN

"He is at risk of losing on both fronts: on one side by strengthening his main opponent in the primaries (Juppe) who is perceived as more moderate, and on the other with a huge credibility issue," said political analyst Jean-Yves Camus.

"His discourse is getting close to that of the FN but it's like Canada Dry: although the taste is similar, voters know it's not the same. And all the more so because Sarkozy used to be in power - why would he do now what he didn't do before?"

Security and warnings that France's identity is under threat are at the heart of Sarkozy's campaign, issues at the forefront of French politics after a series of Islamist militant attacks that have killed more than 200 people since January 2015 and rising concerns about mass immigration as people flee war and poverty in the Middle East and North Africa.

Sarkozy's campaign pledges include locking up all those signaled by intelligence services as posing a possible threat, suspending the right of migrants to have their families join them and scrapping medical aid for illegal immigrants.

Many of his proposals echo those of Le Pen, whose speeches also focus on security and French identity. Sarkozy seized on a heated debate on the full-body burkini swimwear this summer to propose a national ban, something only the FN also called for.

There are differences. The FN would scrap migrant family reunification while Sarkozy would suspend it while European Union open border agreements are re-negotiated. Sarkozy does not propose leaving the euro zone and does not support the FN's "national preference" policy of reserving many rights for the French.

But his proposals have brought him the poisoned chalice of being praised by FN founder Jean-Marie Le Pen, at odds with his daughter Marine, whom he says is too moderate.

Sarkozy's camp say they are nothing like the FN, but stress the law-and-order line chimes with voters' concerns.

"The French want us to speak about those issues. For too long the Right has avoided them and left the field to the FN," said Daniel Fasquelle, a lawmaker close to Sarkozy.

But opinion polls show Juppe remains favorite to win the primary, and the presidential election, while Sarkozy has lost ground.

President in 2007-2012 before losing a first re-election bid to Socialist President Francois Hollande, Sarkozy mocks the soft-spoken Juppe's plan to target centrists and left-wingers disappointed with Hollande, and to build a "happy identity" for France.

Much will depend on turnout in the two-round Nov 20/27 primaries. A low turnout in which only core party members turn up is seen favoring Sarkozy.

But Juppe benefits from the fact that, for the first time, anyone willing to pay 2 euros and sign a document saying they share the values of the right and center can take part in the primaries, widening the constituency.

Scores of left-wing voters are telling pollsters they could take part to block Sarkozy, but the impact of this is hard to gauge, given this is the first time the primaries have taken place under those rules.

Hollande is deeply unpopular and opposition to Le Pen still strong so the winner of the conservative primaries has a strong chance of becoming France's next president.

Sarkozy has another problem. A string of judicial investigations, including on financing of his previous election bids, are also dogging his campaign. He denies any wrongdoing.

"His capacity to be in tune with voters' concerns is damaged by those cases," Miquet-Marty said. "No matter how polarizing his increasingly right-wing line is, he could otherwise have built momentum on it."