Burkina Faso's army says it had ousted president Roch Kabore, suspended the constitution, dissolved the government and the national assembly, and closed the borders.
The announcement, signed by Lieutenant Colonel Paul-Henri Sandaogo Damiba and read by another officer on state television, said the takeover had been carried out without violence and that those detained were at a secure location.
The statement was made in the name of a previously unheard-of entity, the Patriotic Movement for Safeguard and Restoration or MPSR, its French language acronym.
"MPSR, which includes all sections of the army, has decided to end President Kabore's post today," it said.
It cited the deterioration of the security situation and what it described as Mr Kabore's inability to unite the nation and effectively respond to the challenges it faces.
The army broadcast came after two days of confusion and fear in the capital Ouagadougou, where heavy gunfire erupted at army camps on Sunday, with soldiers demanding more support for their fight against Islamist militants.
Mr Kabore's whereabouts were unknown on Monday after heavy gunfire was heard in the area around his residence overnight.
Before the army statement, the African Union and the West African bloc ECOWAS both condemned what they called an attempted coup in Burkina Faso, saying they held the military responsible for Mr Kabore's safety.
Earlier, the government of the West African nation initially denied that the army had seized power.
"What appeared to be a simple mutiny launched by some elements in the army on 23 January is evolving, hour by hour, into a military coup against our hard-fought democracy," the People's Movement for Progress (MPP) said in a statement.
Kabore's whereabouts unknown
Mr Kabore's party said he had survived an assassination attempt, but gave no details. It also said the president's private residence had been sacked, and national TV and radio were being occupied.
A Twitter post from Mr Kabore's account called on those who had taken up arms — an apparent reference to mutinous soldiers — to lay them down. Reuters could not independently verify if Mr Kabore was the author.
"Our nation is going through difficult moments. We must at this precise moment safeguard our democratic norms," said the post, which was signed RK.
"I invite those who have taken up arms to lay them down in the higher interest of the nation."
Following heavy gunfire overnight around Mr Kabore's residence, four security sources and one diplomat told Reuters the president was being detained by mutinous soldiers at an army camp.
However, two other security sources, including one close to Mr Kabore, said he had been taken to a secure location for his own protection.
Reuters could not independently verify Mr Kabore's situation.
The French Embassy in Burkina Faso said the situation was "confusing" and advised French nationals to avoid going out.
Discontent over militant activity
Mr Kabore has faced waves of street protests in recent months as frustration has mounted over the frequent killing of civilians and soldiers by militants, some of whom have links to Islamic State and Al Qaeda.
A militant attack in November on a gendarmerie post in Inata, in the northern Soum region, killed 49 military police officers and four civilians.
It later emerged the forces stationed there had run out of food and been forced to slaughter animals in the vicinity for two weeks.
Protesters came out to support the mutineers on Sunday and ransacked the headquarters of Mr Kabore's political party.
The government declared a curfew until further notice and closed schools for two days.
The turmoil in Burkina Faso comes after successful military putsches over the past 18 months in Mali and Guinea, where the army removed president Alpha Conde last September.
The military also took over in Chad last year after president Idriss Deby died on the battlefield there.
Burkina Faso is one of the poorest countries in West Africa despite being a gold producer.
Islamist militants control swathes of the country and have forced residents in some areas to abide by their harsh version of Islamic law, while the military's struggle to quell the insurgency has drained scarce national resources.
Buffeted by street protests, Mr Kabore had pledged in November to end "dysfunction" in the army, saying an inquiry into the Inata attack would be followed by disciplinary measures and that he would launch an anti-corruption drive.
Some of the anger in Burkina Faso late last year was also directed against former colonial ruler France, which has deployed thousands of soldiers in West Africa's Sahel region to combat the militants.
ABC/wires