Emmanuel Macron faces the toughest test of his presidency as France stands shocked by the latest terrorist attack and its reminder of the dangerous clash of cultures pitting the nation’s secularist traditions against Islamist extremism.
The murder of three people, one of them beheaded, inside the Notre-Dame basilica in the heart of Nice adds to a grim catalogue of terrorism that has plagued France in recent years.
The most recent wave of attacks has occurred at a time of intense debate over the publication of cartoons depicting the Prophet Muhammad.
Mr Macron has stood firm in defence of freedom of expression despite a furious reaction, including boycotts of French products, in several Muslim countries.
“We will not give in, ever,” he tweeted on Sunday, supporting the right of the satirical magazine Charlie Hebdo to publish cartoons even if they caused offence.
“We respect all differences in a spirit of peace. We do not accept hate speech and defend reasonable debate. We will always be on the side of human dignity and universal values.”
The president’s intervention came amid heightened tensions aroused by the beheading on 16 October of Samuel Paty, a French history teacher who had used cartoons to illustrate a classroom discussion on the freedom of expression at a school in Conflans-Sainte-Honorine, in the northwestern suburbs of Paris.
Mr Paty’s killer, an 18-year-old Chechen refugee who was later shot dead by police, was apparently inspired by a ferocious online campaign against the teacher.
In September, two journalists were seriously wounded in an attack outside the former offices of Charlie Hebdo in central Paris.
That incident coincided with the high profile trial, due to continue until mid-November, of 14 people accused of complicity in the attack that left 12 dead – including cartoonists and journalists working for the magazine – in January 2015.
The atrocity in Nice, scene of the lorry attack that killed 86 people on the Promenade des Anglais in 2016, underlines a disturbing reality. Isis may have been defeated militarily and have a seriously diminished capability to organise major terrorist operations in the west. But its propaganda continues to influence gullible individuals and inspire lone-wolf attacks.
The dilemma for Mr Macron is clear. His refusal to condemn blasphemous magazine content has been shown in the starkest terms to carry risks beyond the inconvenience of limited boycotts. Yet he cannot back down without giving a damaging impression of weakness.
His five-year term in office runs out in 2022. Despite poor opinion poll performance for most of his presidency, recent ratings suggest he would again defeat his main rival, Marine Le Pen, leader of the far-right National Rally, in a second-round decider.
Ms Le Pen, who blames lax immigration and security policies for France’s uphill battle against terrorism, is certain to exploit any retreat by Mr Macron from his hardline stance on upholding French values.
Only a tiny minority of France’s estimated six million Muslims are radicalised to the extent that they could turn to violence. But the threat they pose causes a constant headache for police and intelligence services.
An estimated 20,000 people are on the so-called Fiche S list of individuals considered potential security risks, but relatively few are under active surveillance.
Experience has shown the difficulty of keeping track even of listed suspects. A number of attacks, including Mr Paty’s murder and the 2016 massacre on the Nice seafront, have been carried out by people unknown to security agencies.
France has suffered a wave of Islamist outrages that began in 2012 with the killing of seven people, including three Jewish children, in Toulouse and Montauban shortly before that year’s presidential election.
The outgoing head of state, Nicolas Sarkozy, presented himself as the strong leader needed to combat the terrorist threat to France but was beaten by the socialist contender, Francois Hollande.
Mr Hollande in turn had to cope with the Paris attacks of 2015, starting with the Charlie Hebdo murders and followed 11 months later by the mass shootings that killed 130 across Paris.
His firm, dignified response won some admiration outside France but had no impact on his domestic unpopularity and he did not even contest the 2017 election. His successor, Benoit Hamon, was humiliated, eliminated in the first round as Mr Macron swept to an emphatic victory.
With France’s conventional parties of left and right still struggling to recover from their setbacks in 2017, Mr Macron must regard Ms Le Pen as the greatest obstacle to his chances of winning a second term.
She insists she would be more resolute on immigration, the expulsion of Islamists and the protection of the French people against terrorism.
Mr Macron must find a way of reassuring a sceptical electorate, continuing his campaign to eradicate “political Islam” without further alienating Muslim opinion.
He has allies. Jack Lang, a former socialist minister of education and culture and now one of France’s leading champions of moderate Islam, has offered solid backing.
“France is a country that enshrines the liberty of expression that is part of its history,” Mr Lang, president of Paris’s Institute of the Arab World, said this week. “In the past, Catholics tried to censor books, films and works of art and we have always opposed such attempts.
“But our tradition does not mean there is any disrespect. Mr Macron is a humanist and has great admiration for Arab countries, their culture and religion. No one can fairly say he is against Islam.”
An instant poll carried out for the broadcaster LCI suggested 68 per cent of those surveyed found the president convincing when he announced a new national lockdown on Wednesday night.
However, this was eight points down on the approval rating for his handling of the first lockdown in March.
How Mr Macron manages the Covid-19 pandemic might be expected to determine his prospects for 2022.
But the parallel crisis over blasphemy and terrorism and the bloody events of this month cast their own cloud over the presidency and leave France with a deeply uncertain immediate future.