Mali's military coup presents former colonial power France with a diplomatic nightmare, having invested considerable military and political capital in a regional anti-jihadist campaign now in peril.
Tuesday's post-coup resignation of President Ibrahim Boubacar Keita following weeks of civil protest against his perceived corrupt and inept rule, has robbed Paris of a key ally in the Sahel where France has -- sometimes unpopularly -- been routing jihadists since 2013.
The military campaign, spearheaded by France's 5,000-plus Barkhane force in Mali, Burkina Faso, Niger, Mauritania and Chad, seeks in the end to bring stability to the conflict- and poverty-ridden region, allowing governments to strengthen institutions and focus on much-needed development.
But now, France faces having to work with a regime born out of Tuesday's coup d'etat against Keita, often referred to as IBK.
"The challenge will be for France to walk a delicate line. It has to condemn the coup. It also has to work with the new leaders," said Michael Shurkin of the California-based RAND Corporation policy think-tank.
"It (France) needs a good outcome, but it has to be extremely careful about influencing the outcome," he told AFP.
Paris issued a condemnation after initial reports of an army mutiny in Mali, but has yet to explicitly denounce the toppling of Keita claimed by coup leaders.
On Wednesday, French President Emmanuel Macron said "the fight against terrorist groups and the defence of democracy and the rule of law are inseparable.
"To leave is to provoke instability and to weaken our fight. It is not acceptable," Macron wrote on Twitter, calling for power to be "returned to civilians" and for the Malian president and his prime minister to be freed.
Initially expected to last a few weeks, the French Sahel military intervention has been running for seven years at a cost of some $1 billion annually, according to the Council on Foreign Relations in New York.
The force has chalked up some wins, but jihadists have continued deadly attacks and 44 French troops have lost their lives in what some have called "France's forever war".
The presence of French boots on the ground has become increasingly unpopular and thousands have protested in Mali and Burkina Faso against what they term "forces of occupation".
Shrugging off the pleas of the international community, Malian soldiers on Tuesday detained the president, prime minister, cabinet ministers and other government officials.
- Better to come? -
The leaders of the coup condemned by the EU, UN, African Union and regional grouping ECOWAS, insisted that "peace in Mali is our priority" and promised to stage elections within a "reasonable time".
"The junta... does not want to alienate the support of the international community, including Barkhane," tweeted Yvan Guichaoua, a researcher at the University of Kent's Brussels School of International Studies.
"The objective seemingly was mainly to eject IBK and his allies from power."
France itself has been doubtful about Keita's ability to improve security and governance in Mali, say analysts.
And Shurkin believes the coup "could theoretically work out for the best if it yields a government that functions better and that can lay claim to greater legitimacy.
"It has to be acknowledged that things weren’t going well before the coup; Mali under IBK was making little if any progress, which meant that the success of French strategy was questionable anyway," he said.
In the short term, however, French diplomats and military leaders face an uphill battle.
"In a way, it's back to square one," said Jean-Herve Jezequel, Sahel specialist at the International Crisis Group in Brussels.
"Eight years of effort, investment, presence to basically return to the situation of Mali at the time of the 2012 coup, with a confused situation in Bamako, more violent armed insurrections and increased inter-communal violence."
- Change in approach -
Military historian Michel Goya predicted a political imbroglio that will last for months.
"For the French military, this makes things more complicated. Operations can continue, they can be run independently, but cooperation with the Malian forces will likely be stopped. And armed groups may try to take advantage of the situation to expand their action," he said.
France is also likely to see new reticence from European partners it had been trying to convince to enlarge military operations in Sahel, notably a European special forces group dubbed Takuba and the so-called G5 Sahel, an under-resourced force of regional soldiers.
There will be "a slowdown of major projects while we wait for the dust to settle and are focused on the nature of the new power to be installed in Bamako," said Elie Tenenbaum, a researcher at the French Institute for International Relations.
For Shurkin, an extended transition period, or one that yields more of the same, "would be terrible for France and Mali alike".
"Maybe, just maybe, there will be a relatively quick transition that yields a stronger Mali, one that will meet the requirements of French strategy," he added.
For Jezequel, this was also a chance for France, the Sahel states and other partners to question their approach to providing security aid to the region.
"We cannot sustainably secure a space without changing the forms of governance that manage it," he said.