Somalia's former Prime Minister Mohamed Abdullahi Farmajo has won the presidential election.
Farmajo was sworn in on Wednesday after outgoing President Hassan Sheikh Mohamud conceded defeat following two rounds of voting.
"History was made, we have taken this path to democracy, and now I want to congratulate Mohamed Abdullahi Farmajo," Mohamud said.
Farmajo holds dual Somali-American citizenship.
He served as prime minister for only eight months between 2010 and 2011.
Farmajo failed to win the required two-thirds majority but members of the upper and lower houses of parliament gave him a lead in the second round of the election in Mogadishu's secure airport compound.
Some 184 lawmakers voted for Farmajo while Mohamud gained only 97 votes, prompting him to drop out of a third round.
"This is the beginning of unity for the Somali nation, the beginning of the fight against Shabab and corruption ..." 55-year-old Farmajo said after taking the oath of office. He was referring to the al-Shabab terrorist group.
Joy in Mogadishu
As the result of the election was announced, celebrations erupted across the capital.
"Somalia will be another Somalia soon," Ahmed Ali, a celebrating police officer, said.
The current lawmakers, 275 members of the lower house and 54 senators, have been selected by clan elders over the past few months.
Somalia has not seen a powerful central government since former dictator Mohamed Siad Barre was toppled by warlords in 1991.
Since 2007, nearly 22,000 African Union peacekeeping forces have been deployed to the impoverished country in a bid to assist the government’s battle against al-Shabab. The group continues to wage terror attacks in Mogadishu despite having been flushed out of the capital and other major cities by the joint forces of the government and the African Union.