Former Somali leader Hassan Sheikh Mohamud won the presidency again in voting by parliamentarians on Sunday in an airport hangar protected by blast walls from Islamist insurgents whom he must now fight for a second time.
The 66-year-old, who ruled from 2012 to 2017, reversed the previous election to defeat incumbent President Mohamed Abdullahi Mohamed by 214-110 votes in a third-round runoff whose result was confirmed around midnight, reports Reuters.
"We have to move ahead, we do not need grudges. No avenging," Mohamud said in his acceptance speech from the airport compound in the capital Mogadishu patrolled by African Union (AU) peacekeepers.
Supporters defied a curfew to pour onto the streets of Mogadishu, cheering and firing guns into the air.
The former education campaigner and peace activist faces a daunting task in the nation of 15 million people which is suffering its worst drought in four decades and has endured seemingly never-ending conflict since 1991.
Though just holding the election was a success of sorts, many Somalis were sceptical of any real improvement.
Most of the 36 candidates were old faces recycled from the past who had done little to stem war and corruption, they complained. Votes are anyway influenced more by money changing hands than political platforms, Somalis and analysts say.
"Hassan Sheikh is not good but he is the lesser of the two evils. We hope Somalia will be better," said Halima Nur, a mother-of-four in Mogadishu.
"We hope this time Hassan Sheikh Mohamud will improve and become a better leader. We hope Somalia will be peaceful, though this may take time," said student Mohamed Ismail.
'A VERY TEDIOUS TASK'
The United Nations-backed vote was delayed by more than a year due to squabbling in government, but had to be held this month to ensure a $400 million International Monetary Fund programme.
During the first round of voting, blasts from mortar shells rang out near the site but did not disrupt proceedings. There was no claim of responsibility, but Somalis are used to attacks on state institutions from al Shabaab militants.
Somalia has endured conflict and clan battles with no strong central government since the fall of dictator Mohamed Siad Barre in 1991. The government has little control beyond the capital and the AU contingent guards an Iraq-style "Green Zone".
"Let us pray for the new president, it is a very tedious task," said outgoing leader Mohamed, known as "Farmaajo" due to a reputed love of Italian formaggio cheese.
He drew criticism from Somalis and foreign donors for trying to extend his tenure last year.
After long bouts of infighting within government, sometimes spilling over into gun battles between factions of the security forces, the incoming leader sought to strike a new note.
"We cannot forget the painful past but we can forgive," said Mohamud. "Here in this hall I had handed over the presidency to Farmaajo in 2017 and tonight he handed over to me."
Born in the Hiran region of central Somalia, Mohamud has a master's degree in technical education from India's Barkatullah University. He co-founded the SIMAD university in Mogadishu.
Though credited with pushing al Shabaab out of some towns when he was president, Mohamud failed to deliver a crushing blow to the militants who now control swathes of Somalia and run a lucrative extortion business.