Macron the mould-breaker - France's youngest leader since Napoleon
French President-elect Emmanuel Macron celebrates on the stage at his victory rally near the Louvre in Paris, France May 7, 2017. Reuters

It has taken only three years for Emmanuel Macron to rise from being an unknown government adviser to be elected France's youngest head of state since Napoleon.

Elected on Sunday several months before his 40th birthday, the centrist has turned a stale establishment upside down while eschewing the wave of economic and political nationalism that helped Britain to vote for "Brexit" and Donald Trump to be elected U.S. president.

His election represents a long-awaited generational change in French politics where the same faces have dominated for years.

He will be the youngest leader in the current Group of Seven (G7) major nations and has elicited comparisons with youthful leaders past and present, from Canadian Prime Minister Justin Trudeau to British ex-premier Tony Blair and even President John F. Kennedy in the United States.

Many attribute Macron's stunning rise to a deep yearning for a fresh face, coupled with a rare message of optimism in a country that has long been obsessed with national decline.

"His campaign has been like group therapy - to convert the French to optimism," said writer Michel Houellebecq.

The unexpected collapse of many mainstream opponents certainly played a part, but Macron had the tactical nous to seize his chance.

He seemed destined for a steady climb up the ranks of the French establishment when he decided to apply his skills as a deal-making investment banker to the world of politics.

But since striking out on his own in August 2016 after only two years as a minister, he has tapped into widespread disenchantment to broadcast a strong anti-establishment message.

Despite having attended France's most prestigious schools, making a killing by brokering a $10 billion corporate acquisition, and serving in a Socialist government under President Francois Hollande, Macron has vowed to shake up the system that he comes from.

"France is blocked by the self-serving tendencies of its elite," he told supporters at a rally in the southern town of Pau. "And I'll tell you a little secret," he added, lowering his voice: "I know it, I was part of it."

"ALWAYS DOING SO MANY THINGS"

Born in Amiens, in the northern rustbelt, to a family of doctors, he describes in his campaign book "Revolution" an idyllic childhood spent "in books, a little removed from the world".

There, at age 15, he met his future wife Brigitte, who was his drama teacher - 24 years his senior and married with children. Their unusual relationship has fuelled intense coverage by the glossy boulevard magazines.

After school, he moved to Paris and attended the Sciences-Po and the Ecole Nationale d'Administration (ENA) academies, the traditional training ground of the French elite. In parallel, he worked as a research assistant to the philosopher Paul Ricoeur.

"He was always doing so many things at the same time," his Sciences-Po classmate Marc Ferracci told Reuters.

After finishing near the top of his class, he joined the civil service, before a four-year stint working in mergers and acquisitions for the investment bank Rothschild.

Helping to broker Nestle's acquisition of Pfizer's baby food division earned him a small fortune.

After Rothschild, he joined Hollande's staff in the Elysee in 2012 and it was not long before he became economy minister.

"He always wanted to be in politics, be elected. He talked about it all the time," said his ENA classmate Gaspard Gantzer, now Hollande's spin doctor.

In government, Macron set about attacking some of the sacred cows of the French "social model" such as the 35-hour working week, iron-clad job protection, and the civil service's culture of jobs-for-life.

These are messages that have earned him surprising popularity for an ex-banker in a country where many disdain the world of high finance - but also the contempt of many on the traditional left, as well as the nationalist right.

"You are already hated before you have even set foot in the Elysee," left-wing film director Francois Ruffin wrote in an open letter to Macron published last week.

"UBER OF FRENCH POLITICS"

Macron, who sleeps little and can often be seen online on the Telegram messaging service at 2 a.m., says his ambition is to bridge the left-right divide that has long dominated French politics.

Yet when he quit the government last August to build up the political movement he had founded only four months earlier, many saw him as a shooting star - at best.

"He won't last five minutes with the bad guys in the campaign," one of his predecessors at the finance and economy ministry scoffed privately last November.

But with the ruling Socialists in disarray and the centre-right's candidate, Francois Fillon, mired in a financial scandal, Macron emerged in pole position.

"He did to French politics what Uber did to taxis," said Laurent Bigorgne, a friend of Macron's and head of the Institut Montaigne think-tank.

"It was clear from the start that Uber would make taxis obsolete; only the taxis didn't see it coming."

Macron has continued to confound opponents and pundits by building up huge grassroots support and winning endorsements from defecting centre-left and centre-right politicians.

Far-right National Front candidate Marine Le Pen, whom he defeated after an acrimonious runoff campaign, scornfully dubbed him a "smirking banker" in a rancorous TV debate, painting him as the candidate of "globalisation and Uberisation gone wild".

In a final put-down, when Le Pen attempted to interrupt his summing-up, Macron told her: "You stay on TV. I want to be president of the country."