France has backed down on its hardline stance against the coupists who overthrew President Mohamed Bazoum of Niger Republic in July.
The colonial power had kicked against the coup and insisted on the reinstatement of Bazoum.
It had also refused to recognise the junta, which announced that Niger had severed ties with its colonial master.
But on Sunday, President Emmanuel Macron said France would soon withdraw its ambassador from Niger, followed by its military contingent.
France has about 1,500 soldiers in Niger as part of an anti-jihadist deployment in the Sahel region.
In the wake of the coup, France had said its troops would remain in the West African nation despite hostilities by the junta.
“France has decided to withdraw its ambassador. In the next hours our ambassador and several diplomats will return to France,” Macron told French television in an interview on Sunday evening.
He added that military cooperation was over and French troops would withdraw in “the months and weeks to come” with a full pullout by the end of the year.
“In the weeks and months to come, we will consult with the putschists, because we want this to be done peacefully,” he added.
Niger’s military leaders had told French ambassador, Sylvain Itte, to leave the country.
But a 48-hour ultimatum for him to leave, issued in August, passed with him still in place as the French government refused to comply, or to recognise the military regime as legitimate.
Macron in the interview reaffirmed France’s position that Bazoum was being held “hostage” and remained the “sole legitimate authority” in the country.
Macron said French ambassador in Niger was being held hostage in the embassy
“He was targeted by this coup d’etat because he was carrying out courageous reforms and because there was a largely ethnic settling of scores and a lot of political cowardice,” he argued.
The Sahel region south of the Sahara has suffered what Macron has previously called an “epidemic” of coups in recent years, with military regimes replacing elected governments in Mali, Burkina Faso and Guinea as well as Niger.