With tough talk on immigration, security and national identity, the 61-year-old tried to woo voters tempted by the far-right National Front with an unabashedly populist campaign.
But the man known universally in France as "Sarko" was humiliated in the rightwing's first ever primary, finishing third behind the man who served as his prime minister, Francois Fillon, and another ex-premier, Alain Juppe.
"I have no bitterness, I have no sadness, and I wish the best for my country," Sarkozy said in a dignified concession speech.
Sarkozy tried to bury the "bling-bling" image of his 2007-12 presidency by casting himself as a defender of the "down-and-outs against the elites".
His taste for the high life -- he is married to former top model Carla Bruni -- and failure to make good on many of his promises had relegated him to a one-term presidency after he lost to Socialist Francois Hollande in 2012.
In his comeback bid, Sarkozy did not shrink from controversy, sharpening his anti-immigrant rhetoric after the Bastille Day truck massacre in Nice that claimed 86 lives.
The son of a Hungarian immigrant drew a line in the sand by saying in September: "Once you become French, your ancestors are the Gauls."
The remarks appealed to the base of the Republicans party but alienated the moderate right and centre while appalling the left.
His pugnacious style is seen as an asset by his admirers but a liability by his detractors who fault his apparent lack of self-control.
Many remember when Sarkozy visited the 2008 agriculture show in Paris -- a fixture on any top politician's calendar -- and said "get lost, dumbass" to a man who refused to shake his hand.
His temper also flared on Thursday during the last debate before the primary vote, when he slammed as "disgraceful" a question on fresh claims that he received millions in campaign funding from the regime of late Libyan leader Moamer Kadhafi.
Born on January 28, 1955, the football fanatic and cycling enthusiast is an atypical French politician.
He has a law degree but unlike most of his peers did not attend the exclusive Ecole Nationale d'Administration (ENA), the well-worn production line for future captains of government.
Sarkozy was the first French president to divorce, remarry and have a child -- his fourth -- while in office.
Former president Jacques Chirac, Sarkozy's first mentor, once said of him that he "has no doubts about anything, least of all about himself".
Sarkozy became the mayor of the wealthy Parisian suburb of Neuilly-sur-Seine at the age of 28, was an MP six years later and a minister by the age of 38.
After he won the presidency at 52 he was initially seen as injecting a much-needed dose of dynamism, making a splash on the international scene and wooing the corporate world.
It was partly his relationship with Bruni, coupled with his brash approach, that earned Sarkozy the "bling-bling" moniker.
French heads of state were once supposed to rise above the political fray, but opponents accused Sarkozy of cheapening the office.
He is still angered at criticism of his five years in power which were dominated by the 2008 financial crisis and its fallout.
Sarkozy likes to claim that he "saved Europe, if not the world, from a major crisis".
But by the end of his term, he had some of the lowest popularity ratings for a post-war French leader. Only his nemesis Hollande has scored lower.
After his humiliating 2012 defeat by the socialist, Sarkozy famously promised that "you won't hear about me anymore" before turning to the lucrative international lecture circuit.
Few observers were surprised though when he returned to frontline politics in 2014, standing for and winning the leadership of the conservative UMP party, now renamed the Republicans.
A host of legal troubles failed to deter Sarkozy's bid to take care of what he considered unfinished business.
He became the first former head of state to be taken into custody for questioning when he was charged with corruption, influence peddling and violation of legal secrecy in July 2014.
In what is potentially the most damaging case, he is accused of conspiring with his lawyer to give a magistrate a lucrative job in exchange for inside information on a different corruption probe against him, in conversations on a secret phone registered under an assumed name.
by AFP's Beatrice Le Bohec