Mauritania's first freely elected president has formally resigned from office, paving the way for new elections more than 10 months after he was overthrown in a military coup.
Sidi Ould Sheikh Abdallahi handed over power to a transitional government on Saturday under a power-sharing deal with the soldiers who toppled him in August.
He announced his resignation just after midnight after a new round of talks with the country's military rulers brokered by Abdoulaye Wade, Senegal's president, in Nouakchott, the Mauritanian capital.
"I declare that I voluntarily renounce my position as president," Abdallahi said.
He said he is "happy to be the first elected president [in Mauritania] to have consented to give up power to preserve the greater interest".
Mauritania has been ruled by the military since the coup, but Abdallahi had maintained that he is the legal president.
As part of the new deal, an interim government will take over from the country's military rulers to organise the vote.
Elections are scheduled to take place on July 18.
Ministerial positions in the transitional government are to be shared between Mohamed Ould Abdel Aziz's military government and the National Front for the Defence of Democracy, the opposition coalition.
Abdel Aziz's decision to give up power as president in April constitutionally allowed him to run in elections.
Ban Ki-moon, the UN secretary-general, hailed the establishment of a transitional government of national unity as a major step toward consolidating democracy.
A UN statement said on Saturday: "The secretary general welcomes the signing late yesterday of the decree establishing a transitional government of national unity in Mauritania.
"He considers this an important step towards the consolidation of democracy in the country."
Ban expressed hope that the new transitional government "will lead the country towards a free, fair and transparent presidential election, held in a safe environment."
Jean Ping, the head of the African Union (AU), praised Abdallahi's decision to formally step down as the first step to holding peaceful elections, the AFP news agency reported.
Ping "expresses his high appreciation to President Sidi Ould Sheikh Abdallahi for his high sense of responsibility and the general interest," an AU statement said.
"This act opens the way for the organisation on 18 July 2009 of the first round of early presidential elections to enable the Mauritanian people to express their will in full sovereignty," it said.
The AU had imposed sanctions on Mauritania's military rulers earlier this year in response to the coup.