Army officers staged a coup in Mauritania on Wednesday and detained the president and prime minister, overthrowing the first government to be freely elected in the desert country in more than 20 years.

The coup in Africa's newest oil producer took place after the president and prime minister fired the country's top four military officials.

A brief announcement read over state television said the new "state council" will be led by presidential guard chief Gen. Mohamed Ould Abdel Aziz. It gave no other details.

President Sidi Ould Cheikh Abdallahi was being held by renegade soldiers at the presidential palace in Nouakchott, according to presidential spokesman Abdoulaye Mamadouba. Soldiers also detained Prime Minister Yahya Ould Ahmed Waqef, he said.

State radio and television went off air and witnesses said soldiers were deployed throughout the capital. No violence was immediately reported.

Straddling the western edge of the Sahara desert, Arab-dominated Mauritania, with a population of 3.4 million, has been wracked by more than 10 coups or attempted coups since independence from France in 1960.

While most of its people live on about $5 a day, oil reserves were discovered in Mauritania in 2006.

Abdallahi's civilian government took control from a military junta, which seized power in a 2005 coup and stepped down after 2007 elections.

No official reason was given for firing the military officials, announced early Wednesday. Among those fired was army chief staff Gen. Mohamed Ould Sheikh Mohamed.

In recent weeks, lawmakers have accused Abdallahi of corruption and poor governance, and 69 of the country's 95 parliament members called for his resignation.

Lawmaker Mohammed Al Mukhtar told the Arab satellite television station Al-Jazeera by telephone that many people were supporting the takeover attempt. He described the government as "an authoritarian regime" and asserted the president had "marginalized the majority in parliament."

The U.S. embassy urged Americans in Mauritania "to exercise extreme caution to assure their safety. They should remain at home or where they are for the rest of the day" and avoid crowds.

Spokesman Romain Nadal said France's Foreign Ministry was in contact with French embassy officials in Nouakchott and that measures have been taken to protect the safety of French citizens living there.

The bloodless 2005 coup, when Col. Ely Ould Mohamed Vall seized power, was widely popular, for many Mauritanians had grown tired of the 21-year rule of former dictator Maaoya Sid'Ahmed Ould Taya.

Although no junta members ran in the 2007 election, there have been rumors that some in the military were unhappy at being barred from the race. Newspapers also carried stories linking several of the 19 presidential candidates to Taya, now living in exile.

Al-Qaida linked terror groups have also been active in the country, which is one of only three Arab League nations to recognize Israel. Mauritania blamed the 2007 Christmas Eve slaying of four French tourists on a terror group allied with al-Qaida.

The attacks prompted French organizers to canceled the 2008 Dakar Rally, a famous transcontinental car and motorcycle race that brought pride and foreign currency into the country.