The military juntas in Burkina Faso and Mali have said any forcible attempt to restore President Mohamed Bazoum in neighbouring Niger will be seen as a declaration of war on them.
This follows a threat from a regional bloc that it would “take all measures” if the president was not reinstated.
Mr Bazoum is being held by Niger’s coup leaders after being ousted last week.
The region, threatened by an Islamist insurgency, has seen several coups in recent years.
Both Burkina Faso and Mali have severed ties with the West, in particular with former colonial power France, and embraced new alliances with Russia.
Their warning marks a significant twist that could escalate the volatile regional situation.
The joint statement comes as Chadian President Mahamat Idris Déby has been in Niger leading mediation efforts on behalf of the West African bloc Ecowas to resolve the crisis.
In their joint statement, Burkina Faso and Mali threatened that if Ecowas intervened militarily, they would withdraw from the bloc and go to the defence of their eastern neighbour. They said such an intervention would be disastrous and destabilising.
Burkina Faso, Mali and Guinea are all currently suspended from Ecowas following coups in recent years.
Niger, also a former French colony, has been a key Western ally in the fight a jihadist extremism in the Sahel.
After Mali’s military leaders chose to partner up with the Wagner Group of Russian mercenaries in 2021 instead of France’s counter-terror force, Paris moved its centre of operations in the region to Niger.
On Sunday Ecowas gave the junta a week to reinstate the elected president, who has been confined to the presidential palace in the capital, Niamey.
Niger’s junta has not commented on the demand, but vowed to defend the country from any “aggression” by regional or Western powers. It has accused France of planning military intervention.
France did not confirm or deny the claim.
In a statement quoted by Reuters news agency, the French foreign ministry said the only authority it recognised in Niger was President Bazoum’s.