ARTICLE AD BOX
By Tchima Illa Issoufou & Lucy Fleming
BBC News, Niamey & London
Niger's President Mohamed Bazoum has issued a defiant message on Twitter after soldiers announced a coup overnight in the West African nation.
Trouble began early on Wednesday when troops from the presidential guard took him captive.
His foreign minister has said the takeover does not have the backing of the whole military, but the army chief has now said he backs the junta.
Mr Bazoum is a key Western ally in the fight against Islamist militants.
The US and France both have military bases in the uranium-rich country - and have condemned the coup.
US Secretary of State Antony Blinken called up Mr Bazoum promising Washington's "unwavering support" and the UN and the European Union have called for the president's immediate release.
The 64-year-old, who was elected Niger's president two years ago, took to Twitter on Thursday morning to say: "The hard-won achievements will be safeguarded. All Nigeriens who love democracy and freedom will see to it."
The capital, Niamey, is currently deserted, but this is largely because it has been raining heavily all morning.
Even a march planned by those who support the takeover has not happened because of the downpours.
But people in Niger are sharply divided about the turn of events.
Some are shocked and upset and while it was under way on Wednesday, hundreds of the president's supporters defied the soldiers to go out on to the streets and call for the military to return to the barracks.
They dispersed after warning shots were fired - the only gunfire heard in this bloodless seizure of power.
They have said they will not accept the coup but it is not clear how they will oppose it. They have not called any more streets protests for the time-being.
Others have welcomed the military's actions, accusing the ousted ruling party of corruption and not doing enough to improve the security situation and end the long-running jihadist insurgency.
Two neighbouring countries, Mali and Burkina Faso, have experienced coups triggered by jihadist uprisings in recent years.
In both countries the new military leaders have moved closer to Russia after falling out with France, the former colonial power, which also formerly ruled Niger.
This coup is yet further bad news for French and Western efforts to restore stability to the part of West Africa known as the Sahel. When neighbouring Mali chose to partner up with Russia's Wagner Group in place of the French, Paris moved its centre of operations in the region to Niger.
This coup, even if it turns out to be short-lived, has shown that even Niger cannot necessarily be relied on to be a permanent safe base. Western influence in the region is shrinking like a water pool in the dry season.
The governments in Burkina Faso, Central African Republic (CAR) and Mali have all decided they would rather work with Russia's brutal Wagner mercenaries than any Western force. Wagner's primary interests in Africa have appeared to be more about enriching themselves and extending the Kremlin's influence than following the Western goals of trying to nurture better governance.
For the two major insurgent groups in the region, those linked to so-called Islamic State and al-Qaeda, this is good news. They thrive on instability, poor governance and local resentment of the government. So a coup in Niger is likely to further hamper efforts to contain them.
Niger's Foreign Minister Hassoumi Massoudou has called on the population to oppose the takeover.
In an interview with France24, he said that the situation could still be resolved through dialogue and said envoys sent from neighbouring Nigeria were talking to the military.
Benin's President Patrice Talon is also on a mediation mission on behalf of the West African regional bloc, Ecowas.
For the moment, it is not clear who is really in charge.
The takeover was announced by a spokesman, Col Maj Amadou Abdramane, who said the takeover was instigated by the deteriorating security situation "and poor economic and social governance".
For the moment, there is no sign of any Russian involvement in this takeover, or particular influence in Niger.
The vast arid country on the edge of the Sahara desert - one of the world's poorest nations - has experienced four coups since independence from France in 1960, as well as numerous attempted coups.