A large explosion shook the Madagascar capital, Antananarivo, as the army took over the offices of President Marc Ravalomanana, leaving his grip on power hanging by a thread.
Under the cover of darkness, rebel soldiers loyal to opposition leader Andry Rajoelina approached the presidential office in the heart of Antananarivo.
The president was not in the compound but is under mounting pressure to step down. Soldiers moved in after a military official using a loudspeaker ordered all remaining guards inside to leave.
The soldiers drove an armoured vehicle through the gates of the 19th century French mansion, which is used mostly for state ceremonies.
They set off two explosions, fired shots and broke windows and doors.
Round after round of celebratory gunfire could be seen fired into the night air, our correspondent Jonah Fisher said from Antananarivo.
Earlier in the day, opposition leader Andry Rajoelina told a rally that he was in control of the army and had instructed the security forces to arrest the president.
Supporters of Mr Rajoelina accuse the president of misspending public funds, but Mr Ravalomanana's side say his rival is a young troublemaker intent on seizing power illegally.
The army has traditionally remained neutral during periods of political volatility since independence from France in 1960, but Mr Rajoelina has won public backing from the armed forces' self-declared head.
The African Union condemned what it called an "attempted coup" by the opposition and urged the people of Madagascar to respect the constitution.