ANTANANARIVO (Reuters) - Madagascar's constitutional court on Saturday threw out parliament's impeachment of President Hery Rajaonarimampianina, calling the move "unfounded" and helping to avoid a political crisis.
Rajaonarimampianina, who took office last year in the first presidential election since a 2009 coup, had challenged the legality of last month's motion, saying there were irregularities during the impeachment vote in parliament.
He remained in power as both sides awaited the court ruling.
At stake, the president's supporters say, was the stability of the Indian Ocean island nation state which has significant mineral resources but has been struggling to rebuild itself after years of crisis and post-coup isolation.
In a televised speech on Saturday evening, Rajaonarimampianina praised the decision.
"We must fight to ensure that the crisis will not return to our country. Each of us has learned from what happened," he said.
"I call on the Malagasy population, including opponents, to take account of the best interests of the nation, to join hands, to dialogue, to work together and enhance development."
Rajaonarimampianina's critics in parliament brought the motion after accusing him of failing to deliver on his promises since his peaceful 2013 election and of improperly dragging religion into politics by giving speeches in churches.
Mixing religion and politics is a sensitive issue in Madagascar, where just over half the 23 million people practice mostly local animist religions. Former President Marc Ravalomanana, ousted in the 2009 coup, was also blamed for using churches to drum up support when in power.
The president has also been under pressure over his handling of the economy and public services.
Rajaonarimampianina recently allied himself with Ravalomanana's party after being deserted by his previous backers, including Andry Rajoelina, the man who took power after Ravalomanana was ousted in 2009.
Aliarivelo Maromanana, a lawyer representing lawmakers who supported the impeachment vote, said while he accepted the court ruling, he said it was "a political rather than legal decision".
Others, including former Prime Minister Camille Vital, said the next presidential elections should be brought forward.
"An early presidential election is the solution the country needs regardless of the decision of the High Constitutional Court. It belongs to the National Assembly to decide the next step," said Vital.
The next presidential election is due to be held in 2018.
Western donors such as the United States have called for political unity in Madagascar, saying instability was hurting a fragile recovery.
Writing by Edith Honan; Editing by David Clarke and Raissa Kasolowsky