Apparently: https://fr.m.wikipedia.org/wiki/R%C3%A9tention_de_s%C3%BBret%C3%A9_en_France
In French criminal law, “rétention de sûreté” is a procedure for placing prisoners who have served their sentence, but who present a very high risk of reoffending because they generally suffer from a serious personality disorder, in a socio-medico-judicial security center. This measure is limited to convictions for the most serious crimes, in particular sex crimes, and must be expressly provided for in the sentencing decision
Translated with DeepL
I couldn't find an English source, even the English wiki article on preventive detention doesn't list France.
20 years is the maximum sentence in France

Merz says Israeli actions in Gaza 'no longer justified'
He added he planned to hold a call with Israel's Prime Minister Benjamin Netanyahu this week to tell him "to not overdo it," though for "historical reasons," Germany would always be more guarded in its criticism than some European partners.
"But if lines are crossed, where international humanitarian law is really being violated, then Germany, the German chancellor, must also say something about it," Merz said.