Nicolas Sarkozy has bowed out of political life after a humiliating defeat in a primary to decide who will be the right-wing Republican party candidate in the 2017 presidential election.

Former president Sarkozy lost out against his conservative rivals in his bid to regain the office he held from 2007-2012, and said the defeat marked the end of his political career.

"I did not manage to convince the voters," Mr Sarkozy said in an emotional farewell to his team. "I have no bitterness, no sadness, and I wish all the best for my country, for you my fellow citizens, and for the one who will lead this country I love so much."

It was time for him "to take on a life with more private and fewer public passions", he said, going on to thank Carla Bruni, his wife, for her support.

Francois Fillon, a centrist who has expressed admiration for Margaret Thatcher, won the primary with 44 per cent of the vote, while former prime minister Alain Juppe came second with 28 per cent.

Juppe had been favourite to win the primary. Just under 23 per cent voted for Sarkozy, according to official tallies.

Nicolas Sarkozy is calling time on his political career after his defeat in the presidential primary Getty Images

Fillon and Juppe will now face off in a head-to-head contest next Sunday, with the winner to be nominated as the party's presidential candidate.

The candidate is expected to face far right Front National leader Marine Le Pen in the final round of the presidential election, with the ruling Socialists unpopular and in disarray.

Sarkozy had proposed a series of controversial measures in his campaign to regain the presidency, including banning Muslim headscarves from university campuses in the wake of a series of Islamist terror attacks.

In recent years he has been embroiled in a high-profile scandals, after allegedly breaking campaign financing rules in 2012. In September, a judge ruled that Sarkozy should face trial to answer to the allegations.