Two French soldiers have been killed in a hostage rescue in West Africa, said Emmanuel Macron's office.
The quartet was captured in Benin and then taken over the border to the north of Burkina Faso, where the operation took place.
The four hostages — two Frenchmen, a US woman and a South Korean — are now safe, added the Élysée Palace.
Macron's office named the freed hostages as Patrick Picque and Laurent Lassimouillas. The two soldiers killed were Cedric de Pierrepont and Alain Bertoncello.
"This liberation was able to be done thanks to a military operation, driven by French forces overnight on Thursday into Friday in the north of Burkina Faso," said the Elysee in a statement.
"The president of the French Republic wishes to congratulate the army for the release of these hostages and all who worked with them.
"He bows with emotion and seriousness at the sacrifice of our two soldiers, who gave their lives to save those of our fellow citizens.
"He sends his heartfelt condolences to their families, their friends, and their brothers in arms, and shows them all the solidarity of the Nation in these difficult times."
Lassimouillas is a piano teacher and an orchestra conductor in Longjumea, a town 20 kilometres to the south of Paris.
Its mayor, Sandrine Gelot, said on Facebook: "Freed!
"After days of anxiety and waiting, excellent news over the freeing of Laurent and Patrick, thanks to the intervention of French army forces.
"A great relief for their families and all of us."