The military in Burkina Faso says it has seized power and overthrown President Roch Kaboré.
The announcement was made on state television by an army officer, who cited the deteriorating security situation for the military takeover.
Mr Kaboré had faced growing discontent over his failure to stem an Islamist insurgency.
His whereabouts are unclear, but the officer said that all those detained were in a secure location.
The coup comes a day after troops seized barracks, and gunshots were heard in the capital, Ouagadougou.
Earlier, the ruling People's Movement for Progress (PMP) party said that both Mr Kaboré and a government minister had survived an assassination attempt.
On Sunday, mutinying troops demanded the sacking of military chiefs and more resources to fight militants linked to the Islamic State (IS) group and al-Qaeda.
The army statement said Mr Kaboré had failed to unite the nation and to deal effectively with the security crisis which "threatens the very foundations of our nation".
The statement was issued in the name of a group not heard of previously, the Patriotic Movement for Safeguard and Restoration or MPSR, its French acronym.
Although read out by another officer, the statement was signed by Lt-Col Paul-Henri Sandaogo Damiba, who is believed to be the coup leader and a senior commander with years of experience fighting the Islamist militants.
The statement said that parliament and the government had been dissolved, and the constitution suspended, but promised a "return to constitutional order" within a "reasonable time".
The military also announced the closure of Burkina Faso's borders.
UN chief António Guterres condemned the coup and called on the military to "ensure the protection and the physical integrity" of Mr Kaboré.
The African Union and regional bloc, Ecowas, have also condemned the forceful takeover of power, with Ecowas saying it holds the soldiers responsible for the deposed president's well-being.
Earlier, the news of his detention was received with cheers and celebrations in Ouagadougou, reports the BBC's senior Africa correspondent Anne Soy.
Earlier video footage from the capital appeared to show armoured vehicles - reportedly used by the presidency - peppered with bullet holes and abandoned in the street.
Mobile internet services have been disrupted, though fixed-line internet and domestic wi-fi are working.
Burkina Faso: The basics A former French colony, Burkina Faso has suffered chronic instability since gaining independence in 1960, including several coups. The country's name, meaning "land of the honest men", was picked by revolutionary military officer Thomas Sankara who took power in 1983. He was toppled and killed in 1987. Since 2015, the country has been fighting an Islamist insurgency that spilled over from neighbouring Mali. This has fuelled anger in the military and damaged the once important tourist industry.
Mr Kaboré has not been seen in public since the crisis began, but two posts appeared on his Twitter account before the officer announced he had been toppled.
The later one called on those who had taken up arms to lay them down "in the higher interest of the nation". Earlier, Mr Kaboré congratulated the national football team on their win in an Africa Cup of Nations match.
It is unclear who posted the tweets.
Some security sources say the president and other government ministers are being held at the Sangoulé Lamizana barracks in the capital.
On Sunday, hundreds of people came out in support of the soldiers and some of them set fire to the ruling party's headquarters.
The coup comes a week after 11 soldiers were arrested for allegedly plotting to overthrow Mr Kaboré.
But discontent has been growing in Burkina Faso over the government's failure to defeat an Islamist insurgency in the country since 2015.
That escalated in November, when 53 people, mainly members of the security forces, were killed by suspected jihadists. And on Saturday, a banned rally to protest against the government's perceived failure led to dozens of arrests.
Mutinying soldiers made several demands, including: the removal of the army's chief of staff and the head of the intelligence service; more troops to be deployed to the front line; and better conditions for the wounded and soldiers' families.
Similar troubles in neighbouring Mali led to a military coup in May 2021 - one that was broadly welcomed by the public.
Burkina Faso is now the third West African country to witness a military takeover in recent years. Guinea and Mali have had sanctions imposed on them by Ecowas to press them to return to constitutional order.