Mauritania's ousted president has formally resigned and put in place a new unity government under a deal with the soldiers who toppled him to allow a presidential election next month, Reuters reported. President Sidi Mohamed Ould Sheikh Abdallahi announced his resignation late on Friday after a new round of talks with the military rulers brokered by Senegal's President Abdoulaye Wade. "I declare that I voluntarily renounce my position as president," said Abdallahi, Mauritania's first freely elected head of state. He was overthrown after serving for less than two years. Ministerial positions in the interim government will be shared between Mohamed Ould Abdel Aziz's military junta and the opposition coalition, the National Front for the Defense of Democracy. Each faction will get 13 ministers while Prime Minister Moulaye Ould Mohamed Laghdaf keeps his post. Abdel Aziz, a former presidential guardsman, is standing in the election, which was postponed from June 6 under the agreement that meant the opposition would not boycott the vote in the country of 3 million. Abdallahi is not standing. "We are heading towards free and transparent elections on July 18," Abdel Aziz said.