MOGADISHU Members of parliament overwhelmingly elected political newcomer Hassan Sheikh Mohamud as president of Somalia on Monday, a result hailed by supporters as a vote for change in the war-ravaged country.
Bursts of celebratory gunfire crackled through the streets of the capital, Mogadishu, after the first vote of its kind in decades in Somalia drew to a close.
Mohamud won in a secret ballot with 190 votes, against 79 lawmakers voting for Ahmed.
"I congratulate all Somalis. The people are taking a new direction. You are now ending the difficult path and taking a new one," Mohamud said to a cheering crowd of well-wishers.
Although Mohamud is a relatively new face in Somali politics, the one-time academic will be confronted by old problems: acrimonious clan politics, rampant corruption, maritime piracy and a stubborn Islamist insurgency.
Mohamud, seen as a moderate, unexpectedly defeated incumbent President Sheikh Sharif Ahmed after two of the four candidates who made it to the second round of voting dropped out.
One of them, outgoing Prime Minister Abdiweli Mohamed Ali, who threw his weight behind Mohamud, said the result heralded a new era for Somali politics.
"Somalia voted for change," Ali told Reuters, adding it was too early to say whether he would take part in the next administration.
Somalia has lacked an effective central government since the outbreak of civil war in 1991.
The capital, however, which until last year witnessed street battles between al Qaeda-linked al Shabaab militants and African soldiers, is now a vibrant city where reconstructed houses are slowly replacing bullet-riddled structures.
Monday's vote was seen as a culmination of a regionally brokered, U.N.-backed roadmap to end that conflict, during which tens of thousands of people were killed and many more fled.
Despite being on the back foot, the militants still control swathes of southern and central Somalia, while pirates, regional administrations and local militia group also vie for control of chunks of the mostly lawless Horn of Africa country.
"SAFE PAIR OF HANDS"
The outgoing president conceded defeat after onlookers in the hall where the vote was held spontaneously stood up and sang the national anthem.
Attention will now focus on whether all of Somalia's rival clans respect the result, or whether disgruntled factions will seek to destabilize the next government.
"(The) elected president must cope with security first, then the reconstruction of social infrastructure, resettling the numerous (refugees) around the country and the liberation of the rest of the country from al Shabaab," student Bashir Ali Abdikadir said.
Mohamud will also have to tackle Somalia's reputation as the most corrupt country in the world.
In July, a U.N. Somalia monitoring group report said it had found that out of every $10 in revenue raised between 2009-2010 $7 had never made it into state coffers.
A U.N. official who was present at the vote on Monday described Mohamud as "progressive and a safe pair of hands".
Residents said bursts of celebratory gunfire rang out in several cities across central and southern Somalia.
"A supported change is always positive," Mohamud Farah, a spokesman for government forces based in the former rebel stronghold of Afmadow in southern Somalia, told Reuters.
Jabril Ibrahim Abdulle, director of the Somali think-tank Centre of Research and Dialogue, where Mohamud worked for eight years, said the result highlighted Ahmed's failure to quash the festering Islamist insurgency and improve living standards.
"He is benefiting from the fallout over Ahmed. This vote shows that the Somali people were yearning for change," Abdulle said. "His biggest challenge will be the expectations of the people."
Touching a Koran with his right hand, Mohamud was sworn in as president within minutes of his poll victory at a crowded hall in Mogadishu's police academy.
As president, he will head the executive while the speaker of parliament is considered the most powerful politician and steps in if the president is unable to fulfil his duties.
Mohamud graduated from the Somali National University in 1981 before obtaining a master's degree in education from India's Bhopal University in 1988.
During the early years of Somalia's civil conflict, he worked for the U.N. children's agency, UNICEF.
In 1999, the fluent English speaker co-founded the Somali Institute of Management and Administration Development in Mogadishu, which later became Simad University, and served as its dean until 2010.
In 2011, he founded the Peace and Development Party.
The selection of Somalia's new lawmakers, whose first real task was to elect a new president, was marred by allegations of bribery and intimidation designed to manipulate Monday's vote.
Even so, many Somalis were elated their country was holding an election of sorts.
"It's something we have to witness and be a part of, even if we're not voting. We've been through a very difficult labor and we're finally giving birth," said Najmah Ahmed Abdi, who runs a Somali youth forum.
"The (lawmakers) have a momentous responsibility on their shoulders. Tomorrow will be like when U.S. President Barack Obama was elected. We hope we get our own Obama."
(Additional reporting by Mohamed Ahmed and Abdi Sheikh; Writing by Yara Bayoumy and Richard Lough; Editing by Alison Williams and Michael Roddy)