President Emmanuel Macron announced Sunday that France will end its military presence in Niger and pull its ambassador out of the country after its democratically elected president was deposed in a coup.

The announcement is a significant, if predicted, blow to France's policy in Africa, after French troops pulled out of neighboring Mali and Burkina Faso in recent years after coups there. France had stationed thousands of troops in the Sahel region at the request of African leaders to fight jihadist groups.

France has maintained some 1,500 troops in Niger since the July coup, and had repeatedly refused an order by the new junta for its ambassador to leave, saying that France didn't recognize the coup leaders as legitimate.

Tensions between France and Niger, a former French colony, have mounted in recent weeks, and Macron said recently that diplomats were surviving on military rations as they holed up in the embassy.

In an interview with France-2 television, Macron said that he spoke Sunday to ousted President Mohamed Bazoum, and told him that "France has decided to bring back its ambassador, and in the coming hours our ambassador and several diplomats will return to France."

He added, "And we will put an end to our military cooperation with the Niger authorities because they don't want to fight against terrorism anymore."

He said the troops would be gradually pulled out, likely by the end of the year, in coordination with the coup leaders `'because we want it to take place peacefully."

He said France's military presence was in response to a request from Niger's government at the time. That military cooperation between France and Niger had been suspended since the coup, however. The junta leaders claimed that Bazoum's government wasn't doing enough to protect the country from the insurgency.

The junta is now under sanctions by Western and regional African powers.

The junta in August gave French Ambassador Sylvain Itte 48 hours to leave. After the deadline expired without France recalling him, the coup leaders then revoked his diplomatic immunity.

In New York on Friday, the military government that seized power in Niger accused U.N. Secretary-General Antonio Guterres of "obstructing" the West African nation's full participation at the U.N.'s annual meeting of world leaders in order to appease France and its allies.

Experts say that after repeated military interventions in its former colonies in recent decades, the era of France as Africa's "gendarme" may finally be over, as the continent's priorities shift.

Andrew Lebovich, a research fellow with the Clingendael Institute, a think tank, said the decision marks both an acceptance of a "harsh reality for France in the region and may possibly put some limits on the U.S. deployments in Niger, though as we have seen the U.S. and France have not followed exactly the same positionings in Niger."

Rida Lyammouri, a senior fellow at the Policy Center for the New South, a Morocco-based think tank, said Niger will feel the loss of French support in its fight against violent extremist organizations.

"France has been a reliable partner providing support to its operations and Niger simply doesn't have an alternative to fill this void by the French, at least in short and mid term," Lyammouri said.

Macron last year withdrew French troops from Mali following tensions with the ruling junta after a 2020 coup, and more recently from Burkina Faso, for similar reasons. Both African countries had asked for the French forces to leave.

France also suspended military operations with Central African Republic, accusing its government of failing to stop a "massive" anti-French disinformation campaign.