In August 2014, Mr Emmanuel Macron was cycling along the northern coast of France near Le Touquet, where his wife owns a house, when he received a call from the Elysee Palace. Two months before, he had fallen out with Socialist President Francois Hollande, who had refused to give his 36-year-old economic adviser a ministerial job in a government reshuffle. Intent on putting politics behind him, Mr Macron had resigned to set up a company in the education sector.
"I preferred to be on my own, to be an entrepreneur and teach," he recalls in his book Revolution. "I did not plan to come back."
But on that summer day, his former boss offered him the Economy Ministry - a job former presidents Valery Giscard d'Estaing, Jacques Chirac and Nicolas Sarkozy had held before him. So Mr Macron came back.
The appointment was one of many lucky breaks that have brought this political novice within reach of the presidency. Mr Macron won the first round of the presidential election last Sunday with 24 per cent of the vote, coming ahead of Ms Marine Le Pen, the resurgent far-right leader whom he will face in a run-off on May 7.
Leading a year-old political movement called En Marche! (On the move), which he insists is neither on the right nor the left, he has pulverised a divided Socialist party and seen off the centre-right Republican nominee Francois Fillon, who remains embroiled in an embezzlement scandal. In a country mesmerised by the spectacle of national decline and traumatised by Islamist terror attacks, Mr Macron has chosen to run an optimistic campaign promising far-reaching economic reforms. And if the opinion polls are right, he is set to be elected president with around 60 per cent of the second-round vote, turning back the populist wave that brought Mr Donald Trump to power in the United States and led to a vote for Brexit in Britain.
Mr Macron's ascent has been one of academic success and uncanny timing. He grew up in a middle- class family in the quiet northern town of Amiens. At school, the blond-haired, blue-eyed "Manu" was nerdy, often staying behind in the classroom to chat with teachers. He met his future wife Brigitte Trogneux, 24 years his senior and a married mother of three, at a private Catholic lycee where she taught drama and literature. They married in 2007.
In a country mesmerised by the spectacle of national decline and traumatised by Islamist terror attacks, Mr Macron has chosen to run an optimistic campaign promising far-reaching economic reforms.
Paris university friends recall a student with a rich intellectual life. In addition to ENA, the elite institution that grooms top civil servants, his formative years included a master's degree in philosophy and a stint as assistant to philosopher Paul Ricoeur. His encounter with Mr Michel Rocard, the late Socialist reformist prime minister, shaped his liberal political thinking.
"From Rocard, he has kept the belief that the state has a role to play in the economy but cannot do everything, that you need pro-business policies before redistributing and that benefits aren't efficient enough to correct inequalities," says Mr Macron's friend Marc Ferracci, an economist at Sciences Po.
The candidate belongs to a generation that has seen the rise and then the normalisation of the far right. He was an intern at the French Embassy in Nigeria when Mr Jean-Marie Le Pen, Marine's father, unexpectedly qualified for the presidential run-off against Mr Chirac on April 21, 2002.
Six years later, Mr Macron joined Rothschild, the investment bank, on the recommendation of powerful ENA alumni. He earned his colleagues' respect and €2.9 million for his role advising Nestle on its US$12 billion acquisition of a unit of Pfizer in 2012. In his spare time, he helped Mr Hollande's campaign for the Socialist presidential nomination, before the early favourite in the race, former International Monetary Fund chief Dominique Strauss-Kahn, dropped out after his arrest in New York in 2011.
By mid-2015, Mr Macron had become a popular figure and an enemy of his own side, making regular swipes at the 35-hour working week, the wealth tax and the privileges of a caste of political and economic insiders. After painful negotiations to pass a deregulation Bill in Parliament, Mr Macron began planning a new party, as Mr Jean Pisani-Ferry, an economic adviser to the candidate, recalls. "He was frustrated," Mr Pisani-Ferry says.
"Centre-right MPs would tell him, 'I like your Bill but I can't back it, sorry'." Rebel Socialist MPs, meanwhile, opposed the law because it was too right-wing.
This was the moment that Mr Macron "struck a long-term employment contract with providence", says Mr Alain Minc, a businessman and political adviser. Mr Macron started En Marche! in April last year, resigned from the government in August and announced his presidential bid in November.
A series of unforeseen events opened up space in the political centre ground: Mr Fillon, an admirer of Mrs Margaret Thatcher, won the Republican primary against long-time favourite Alain Juppe; a month later, President Hollande decided not to seek re-election; Mr Benoit Hamon, a left-winger who had opposed Mr Macron's labour market reforms, won the Socialist nomination in January; later that month, the "Penelopegate" scandal erupted, undermining Mr Fillon's presidential bid.
Mr Macron's "intuition was spot- on, he made the right assessment of the situation", notes Mr Pascal Lamy, a former World Trade Organisation chief and a friend. "And then he took his chances."
• The writer is FT's Paris bureau chief