Madagascan forces put down a three-day mutiny Saturday when they stormed an army base and arrested dissident soldiers who had declared a coup in the troubled Indian Ocean island.
Gunshots and explosions rang out as around 400 armed soldiers launched the assault on the army barracks where the 20 or so renegades were holed up.
The dissident soldiers announced on Wednesday that all government institutions were suspended and that a military council had taken charge.
But by Saturday afternoon hundreds of troops had descended on the camp.
"Loyal forces are storming into the camp to neutralise the mutineers," an officer at the scene told AFP.
"The officers (mutineers) have given themselves up. It is some junior soldiers who are firing back."
Shortly afterwards the head of the country's senate defence council declared the operation at the camp about 15 kilometres (nine miles) from the capital Antananarivo a success.
"The operation is over. They gave themselves up. It has ended without bloodshed," said Alain Ramaroson.
"We took the necessary measures. Their conditions were unacceptable. They wanted the dissolution of the transitonal" authority, he said.
General Noel Rakotonandrasana, the leader of the rebel officers, maintained Saturday that they would not relent in their pursuit and vowed not to give in to the authorities.
"At the moment the best solution is to not reconcile with the authorities. The essential thing is to change what is wrong in the country," the general told AFP by phone earlier Saturday.
The Madagascan regime, itself in power following a March 2009 coup, had launched talks with the mutineers on Thursday and army chief Andre Ndriarijaona called for calm.
The coup attempt however failed to attract a wider backing by the rest of the army and business in Antananarivo went on uninterrupted.
Madagascar has been mired in a political crisis since last year's coup when then opposition leader Andry Rajoelina toppled president Marc Ravalomanana with the army's support.
General Rakotonandrasana played a crucial role in the coup, following which he was named the armed forces minister. But he was later dismissed from the post on suspicion of plotting against the current regime.
"We should opt for the creation of a committee to steer towards the right direction and good governance," Rakotonandrasana said, promising to pursue the coup bid "to the end."
The United States condemned the coup attempt and called for dialogue.
Rajoelina has been isolated by the international community and the African Union suspended Madagascar from the bloc and imposed sanctions on him and his backers for failing to honour accords to end the crisis.
Wednesday's coup attempt came as Madagascans were called to vote in a constitutional referendum which kick started a fresh bid by the coup regime to restore normality.
The referendum was part of an August agreement between the regime and scores of smaller parties, and which also calls for municipal, parliamentary and presidential elections.
But hundreds of demonstrators on Saturday protested against the electoral timetable which set municipal elections for December.
Security forces fired teargas to disperse the demonstrators called by the Madagascan Mayors' Association and arrested the organisation's leader.