Somali women danced in the streets and anti-aircraft missiles were blasted into the air on Saturday to celebrate the election of Sheikh Sharif Ahmed as president.
The moderate Islamist leader won the presidency in an all-night parliament session in neighbouring Djibouti on Saturday and vowed to end conflict in the Horn of Africa nation, make peace with neighbours and rule with honesty and justice.
"We are supporting our newly elected president of Somalia, because he is a peaceful man we expect him to practice our religion. We love him and that is why we are supporting to him," Ali Hashi Hirsi said.
Thousands of supporters converged in the capital Mogadishu's war-battered stadium chanting "long live Sheikh Sharif".
In Mogadishu and some central parts of the country, not under the control of Islamist militants, people stayed up all night to watch television or listen to the radio.
"Welcome Sharif, we are tired of war. Let Somalis join hands," Farhia Hassan, a mother of three, said as she waved a green branch symbolising peace.
New Islamist Leader
Somalia's parliament elected moderate Islamist opposition leader Sheikh Sharif Ahmed as new national president on Saturday during a run-off vote in neighbouring Djibouti.
Ahmed passed the necessary majority of votes, 213, just before 4 a.m. local time (0100) during an all-night session of parliament under a U.N.-brokered plan to forge a unity government in the Horn of Africa nation.
Applause broke out in the session.
The Islamist, who headed the sharia courts movement that ruled Mogadishu and most of south Somalia in 2006 before an Ethiopian military intervention, defeated Maslah Mohamed Siad, son of ex-dictator Mohamed Siad Barre, in the second round of voting.
Analysts say that Ahmed has the best chance of all the presidential candidates to unite Somalis, given his Islamist roots and acceptability to other sides.
Parliament was meeting in neighbouring Djibouti due to clashes between rival Islamist factions in Somalia.
Prime Minister Nur Hassan Hussein, who had been viewed as Ahmed's main rival for the presidency, pulled out of the race after scoring just 59 votes in the first round of the election.
New president Ahmed will now fly at the weekend to an African Union (AU) summit in Ethiopia before returning to Somalia to put together a unity government.
Somalia has had no real central government since warlords ousted Mohamed Siad Barre in 1991.
Al Shabaab has denounced the Djibouti election as meaningless. It captured the seat of parliament in the central town of Baidoa this week, meaning the government only controls a few blocks of Mogadishu.
"The international community is electing a Somali president of their choice ... just like (President) Hamid Karzai of Afghanistan," said Mogadishu mechanic Mohamed Abdulle, 35.
Many Afghans see their president Karzai as "puppet" of United States and its western allies.