The soldiers, mostly from the Presidential Guard pledged to bring in democracy, in a coup which sparked condemnation from overseas leaders.
In a written statement Mauritania’s director of national security, Colonel Ely Ould Mohammed Vall, said he had become head of the junta, or Military Council for Justice and Democracy.
“The military and the security forces have unanimously decided to put an end to the totalitarian practices of the regime from which our people have suffered so much in the last years,” the statement said.
It was issued several hours after troops took over the armed forces headquarters and state radio and television buildings at dawn.
Troops also surrounded government ministries and the presidential palace in the capital Nouakchott.
Some residents of the city later emerged from their homes to express support for the coup leaders in apparently spontaneous protests.
President Ould Taya, a former army chief of staff who ruled with an iron fist since staging a bloodless coup in 1984, has taken refuge in the west African state of Niger.
He had been in Saudi Arabia for the funeral of King Fahd, and was prevented from returning home when the military closed down Nouakchott airport.
In New York, UN Secretary General Kofi Annan condemned the army’s latest attempt to seize power, with spokesman Stephane Dujarric saying he was “deeply troubled” by the reports from Nouakchott.
The pan-continental African Union issued a statement reaffirming its “total rejection… of any unconstitutional change of government and the importance of respect for constitutional order.”
In Brussels, the European Union’s executive commission also condemned the coup attempt.
In Paris, however, a foreign ministry statement said only that France was “closely following” the situation in Mauritania, but had no further comment at this stage.
In June 2003, an uprising failed to unseat President Ould Taya, and was followed in August and September of last year by two more alleged coup attempts.
President Ould Taya, a strong ally of the United States, controls about one billion barrels of oil and 30 billion cubic meters of natural gas, according to the government, but has scarcely begun production.
He was elected president first in 1992, again in 1997 and for a third time in November last year in an exercise condemned as a “masquerade” by the opposition.
His government recently cracked down on Islamist radicals, accusing them of links to terrorism in the wake of a clash on the Algerian border.