While France mourns the dead of a wave of Islamist attacks on Paris, President Francois Hollande and his two likely main challengers are calibrating their response with one eye on the 2017 presidential election.
Hollande, 61, a Socialist who is deeply unpopular due to high unemployment and economic stagnation, is using the advantages of incumbency to reinvent himself as a decisive war leader and a compassionate father of the nation.
Nicolas Sarkozy, 60, his centre-right predecessor, is hesitating between statesmanlike support for national unity at a time of crisis and the itch to criticise a successor he has always belittled as weak and irresolute.
Paradoxically, hard right National Front (FN) leader Marine Le Pen, 47, initially softened her shrill anti-Islamist, anti-immigration rhetoric, apparently convinced that events were turning voters in her direction anyway. It didn't last long.
In what many have called France's "9/11 moment", Hollande won a standing ovation from a rare joint session of parliament on Monday after declaring that France was "at war" with Islamic State militants, and would wage a merciless campaign against them while beefing up its internal security.
The respected centre-left daily Le Monde headlined it "Hollande's security U-turn".
Borrowing from his right-wing opponents' programmes, Hollande announced a big increase in law enforcement spending and recruitment, a constitutional amendment to give the state more emergency powers to fight terrorism, and measures to strip dual nationals convicted of national security offences of French citizenship.
And he stepped up air strikes on Islamic State targets in their Syrian stronghold city of Raqqa, while urging the United States and Russia to join forces with France to fight the common enemy instead of leading rival coalitions in Syria.
"Public opinion will not be content with compassion. It will judge the president on his actions," said Frederic Dabi, deputy director of the IFOP polling institute.
"He ticked the right boxes in his Versailles speech in terms of authority, firmness and martial tone. He did the job. He showed once again he can handle outsize events."
ACTION TRUMPS TALK
In such exceptional circumstances, the government has the monopoly on action while opposition politicians can only talk.
Hollande invited Sarkozy and Le Pen to briefings at the Elysee presidential palace, playing the card of national unity.
Sarkozy emerged saying France needed to change its foreign and security policies, working with Russia in the Syrian conflict and drastically toughening internal security, notably by placing 11,500 Muslims who are on a "radicalisation" watch-list under house arrest with electronic tags.
He then appeared to wobble when his parliamentary floor leader said there was no need for a constitutional amendment, only for Sarkozy to say the next day he was open to the idea, first proposed by his political mentor, former prime minister Edouard Balladur.
Le Pen has steadily risen in opinion polls and was expected to make big gains in regional elections next month even before Friday's attacks on Paris restaurants, a music hall and a sports stadium prompted politicians to suspend campaigning.
She resisted the temptation to crow "I told you so" when the gunmen and suicide bombers turned out to be second-generation Arab immigrants, and when one of them was found to have entered Europe recently with Syrian refugees.
In her first reaction, she praised Hollande's "positive shifts" on working with Russia and strengthening the police and gendarmerie after 12,500 job cuts under Sarkozy's rule.
But in a television interview on Tuesday evening, Le Pen dismissed Hollande's proposals as "baby measures" and said the government should resign if it had any sense of honour.
Victims of past Islamist attacks had "died for nothing" because successive governments had "done nothing", she said.
"The whole theme of the last three days - the fact that most of the assassins came from immigration to France, the failures of security surveillance and judicial follow-up - plays into the hands of the FN," said Pascal Perrineau, a professor of French politics at Paris' Sciences-Po university.
"Sometimes contamination with the National Front's discourse goes as high as the president. He talked about closing borders and stripping dual nationals of their citizenship," Perrineau said. But voters, he added, were looking for reassurance and experience in times of crisis, and neither of those were Le Pen's strengths.
Hollande, whose approval rating had sunk to 13 percent, the lowest in the history of France's 57-year-old Fifth Republic, enjoyed a brief bounce after his widely praised handling of a previous set of deadly Islamist attacks on the satirical weekly Charlie Hebdo and a Jewish supermarket in Paris in January.
The president led a million-person march with world leaders in support of freedom of speech after overseeing decisive police intervention that saved dozens of lives then, and striking a tone that embodied national dignity and determination.
The upturn did not last long. The Socialists suffered heavy losses in municipal elections in March. The economy has since begun to pick up slowly, and unemployment finally seems to have peaked, but Hollande has drawn scant political benefit.
He has said he will seek re-election in 2017 only if his government has succeeded in reversing the rise in jobless rolls.
In the three-horse presidential race that was shaping up before the Paris attacks, many analysts were predicting the left could be eliminated on the first round, as Socialist Lionel Jospin was in 2002, leaving a run-off between Sarkozy and Le Pen. Her father was beaten in the second round by then-President Jacques Chirac.
Another such outcome no longer looks quite as likely.
"You could expect the extreme-right and the left to benefit from the situation in the first instance - the far-right because the issues are its traditional strengths, and the left because it has finally embraced the issue of security," said Jean-Daniel Levy, head of politics at pollster Harris Interactive.
The coming weeks will give Hollande more opportunities to display statecraft. He has visits to Washington and Moscow planned for next week, billed as an effort to persuade the two biggest global powers to make common cause against Islamic State.
And by invoking the European Union's mutual assistance clause and declaring that security spending comes before EU budget rules, Hollande offered something to pro-Europeans, sovereigists and leftists alike.
But voters are ultimately likely to judge him on his economic results, and the Paris attacks could weaken a feeble recovery, making it harder to seriously reduce jobless queues.
"Economic concerns will return to the fore" once the threat of terrorism has receded, said Gael Sliman, president of the Oxoda polling institute.