Updated

Madagascar's highest court on Wednesday endorsed the army's move to replace the toppled president with his rival, but the African Union was considering whether it constituted a coup.

Supporters of opposition leader Andry Rajoelina had approached the constitutional court to affirm the army's action.

In a radio address Wednesday, the court declared that Rajoelina "is serving as president of the republic" — even though at 34, Rajoelina is six years too young to do so under the country's constitution.

The court gave no reasons, saying only that Marc Ravalomanana had vacated his presidential post and left the military to make the decision on how it would be filled.

For months, Rajoelina has been leading anti-government rallies and pressing Ravalomanana to step down so he could replace him. He accused Ravalomanana of misspending public funds and undermining democracy on this Indian Ocean island off Africa's southeast coast.

Some of Rajoelina's protests led to deadly clashes. The deaths of at least 25 civilians last month cost Ravalomanana the support of a faction of the military, and a mutiny spread and gained popular support.

After weeks of insisting he would never resign, Ravalomanana announced Tuesday afternoon he was ceding control to the military.

Almost as he spoke, Rajoelina was parading triumphantly through the capital surrounded by armed soldiers and an adoring crowd after seizing control of one of the city's presidential palaces and taking the oath of office there as president of what he called a transitional authority. Rajoelina has promised new presidential elections within two years.

In a ceremony broadcast from a military camp in the capital late Tuesday, Vice-Admiral Hyppolite Rarison Ramaroson said he and two other generals rejected Ravalomanana's attempt earlier that day to transfer power to the military.

Ramaroson said the military instead was installing the president's bitter rival Rajoelina as the country's leader.

The African Union was examining whether what had taken place was a coup, which would lead to Madagascar's automatic suspension from the continentwide body, said Bruno Nongoma Zidouemba, temporary chairman of the AU's Peace and Security Council. He said a meeting on the issue was set for Thursday.

France, Madagascar's former colonial power and current main donor, said Tuesday that two years was "too long" to wait for elections.

"Our hope is that Madagascar returns quickly to normal constitutional order," Foreign Ministry spokesman Eric Chevallier added at a daily media briefing.

Regional power South Africa expressed concern on behalf of the Southern African Development Community at "unconstitutional attempts undertaken by the opposition that led to the resignation of the democratically elected president of a SADC member country."

The streets of the capital were calm Wednesday, but residents were worried.

Tahiana Rakotoniaina, a financial consultant, said he did not believe Rajoelina was capable of running the country and he did not believe Ravalomanana's supporters would accept defeat quietly.

"I'm not sure it's really over," said Emeline Raharinandrasana, a retired office worker. "Is this new authority legal? If not, will the international community continue to help us? That worries me the most."

But Dieudonne Randriantsoa, a teacher, said the international community would in the end have to "accept the will of the people ... as happened in 2002."

Ravalomanana clashed with former President Didier Ratsiraka when both claimed the presidency after a disputed December 2001 election. After low-level fighting split the country between two governments, two capitals and two presidents, Ratsiraka fled to France in June 2002.

Ravalomanana won re-election in 2006, though two opposition candidates tried to challenge the validity of that vote.

"Will we never have democratic change?" asked Antananarivo resident Mirana Razanaparany. "Why does it always have to come from the streets?"