Somali lawmakers have sworn in moderate Islamist leader Sheikh Sharif Sheikh Ahmed as the country's new president.
During a runoff vote early Saturday in Djibouti, President Sharif received 293 votes by secret ballot. He replaces former president Abdullahi Yusuf Ahmed, who resigned in December following months of political infighting.
President Sharif defeated the son of former President Mohamed Siad Barre, who got 126 votes. Another rival, Somali Prime Minister Nur Hassan Hussein, dropped out of the race after the third round of balloting.
The lawmakers met in Djibouti because of the instability in Somalia.
President Sharif was expected to fly immediately to Ethiopia's capital, Addis Ababa, to attend the African union Summit.
His win marks a major boost in efforts to create an inclusive government in Somalia.
Lawmakers had voted earlier this week to double the size of the parliament to include Mr. Sharif's moderate Islamist party - Islamist Alliance for the Re-Liberation of Somalia, or ARS.
President Sharif had previously headed the Islamic Courts Union, which briefly controlled much of Somalia in 2006. Last year, he signed a peace agreement with the government.
However, hardline Islamists did not accept that peace deal, and insurgents continue to fight for more territory across the country. Somalia's government now controls only parts of the capital, Mogadishu, with the help of several thousand African Union troops.
Somalia has not had an effective central government since hardline ruler Mohamed Siad Barre was ousted in 1991.