In 1960, the Republic of Mauritania became independent of France. The conflict over the former Spanish territory of Western Sahara in 1976 resulted in partial annexation by Mauritania, withdrawn in favour of Morocco in 1979. The long-serving dictator Maaouya Ould Sid'Ahmed Taya was ousted by the military of Mauritania and replaced by the Military Council for Justice and Democracy in a coup d'état in 2005. A new constitution was passed in 2006. An indecisive election in 2007 triggered another coup in 2008. A leader of the 2005 coup, Mohamed Ould Abdel Aziz, was elected president in 2009. After his ten-year presidency Mohamed Ould Ghazouani's victory in the 2019 Mauritanian presidential election was presented as having been the country's first peaceful transition of power since independence.