Lawmakers have elected Hassan Sheikh Mohamud as Somalia's new president after the 56-year-old university lecturer got the majority of votes in a second round run-off in the presidential poll.
The run-off pitted him against former president Sharif Sheikh Ahmed.
Hassan Sheikh Mohamud garnered 190 votes against 79 for Sharif, according to a tally by an AFP reporter at the scene.
The two men were neck and neck in the first round of voting but Hassan Sheikh Mohamud emerged victorious in the second and final round.
"Hassan Sheikh Mohamud is the winner for today's presidency," parliament speaker Mohamed Osman Jawari announced.
Two other candidates, outgoing prime minister Abdiweli Mohamed Ali and Abdikadir Osoble, pulled out after the first round of the polls that mark the final stage of a UN-backed process aimed at setting up a new administration for the war-torn country.
Hassan Sheikh Mohamud was a largely unknown candidate who comes from the same Hawiye clan as Sharif. Analysts say he has been actively involved with Somalia's NGO community.
He is an academic, and a political and civic activist who has worked for several national and international peace and development organisations.