Presidential guards in Niger have seized President Mohamed Bazoum and blockaded his residence, as well as key ministries, sources say.
The African Union, the UN, the EU and the United States have all condemned their actions.
President Bazoum is a key western ally in the fight against Islamist militancy in West Africa.
Crowds in the capital Niamey have taken to the streets of in support of the president.
The city has been mostly peaceful, although soldiers behind the coup attempt fired shots in an attempt to break up the protests.
Earlier on Wednesday, the president’s office tweeted that the guards unsuccessfully tried to get support from the military in their “anti-republican” efforts.
One unnamed source told AFP the move was a “fit of temper” by troops.
Reports had said the immediate former president, Mohammed Issoufou, and other former leaders were involved in talks to stop the situation from escalating, but it is not clear if those talks are still taking place.
A source cited by AFP as being close to the president said that the talks had broken down and that the guards, who have refused to release the president, have been issued an ultimatum by the army.
“The Army and the National Guard are ready to attack” those involved in this incident, the president’s office said in a tweet. “The President of the Republic and his family are doing well,” it added.
A BBC reporter in Naimey has seen heavily armed forces loyal to the president stationed around the national broadcaster.
The West African economic bloc (Ecowas) has released a statement describing events in Niger as an “attempted coup” and says it “condemns in the strongest terms the attempt to seize power by force”.
The body also wrote that the bloc will hold those involved responsible.
France and the European Union have also condemned the unrest.
Two neighbouring countries, Mali and Burkina Faso, have experienced coups triggered by jihadist uprisings in recent years.
Niger is grappling with two Islamist insurgencies – one in the south-west, which swept in from Mali in 2015, and the other in the south-east, involving jihadists based in north-eastern Nigeria.
Militant groups allied to both al-Qaeda and Islamic State are active in the country.
Since seizing power, the military leaders of Mali and Burkina Faso have fallen out with France, the former colonial power in both countries, as well as Niger.
In contrast, President Bazoum, who was democratically elected in 2021, is a close ally of France, and other Western nations.
Niger has experienced four coups since independence from France in 1960, as well as numerous attempted coups.
The country’s last coup occurred in February 2010, overturning then President Mamadou Tandja.