Somalia's new president Hassan Sheikh Mohamud is a former academic and peace activist whose first administration was dogged by claims of corruption and infighting.
Sworn in after midnight on Sunday following a marathon vote by lawmakers, Mohamud is the first Somali president to win a second term.
He has vowed to transform the troubled Horn of Africa nation into "a peaceful country that is at peace with the world."
But he will inherit several challenges from his predecessor Mohamed Abdullahi Mohamed, including a devastating drought and a long-running fight with Al-Shabaab insurgents -- who tried to assassinate Mohamud during his first term from 2012-2017.
He will also need to repair the damage caused by months of political chaos and infighting, both at the executive level and between the central government and state authorities.
At his swearing-in in the capital Mogadishu, Mohamud struck a conciliatory tone, hailing Mohamed, better known as Farmajo, for enabling a peaceful transfer of power.
"It is indeed commendable that the president is here standing by my side, we must move forward and never backwards, we have to heal any grievances," he said.
The pair's bitter rivalry dates back to 2017, when Mohamud lost his bid for re-election to Farmajo.
In February 2021, violent protests broke out when Farmajo sought to extend his rule by decree after his term ended without a fresh vote. Mohamud was a key figure in forcing the president to seek consensus on the way forward.
Following his success in marshalling the support of other anti-Farmajo presidential candidates, he will now need to focus on reuniting the country, observers say.
"The past five years have been very polarising," Samira Gaid, executive director of the Mogadishu-based Hiraal Institute think tank, told AFP.
"His message to them, the federal member states and the MPs that supported President Farmajo, is not to fear his presidency. I think... that (is the) kind of work, on reconciliation and political dialogue that needs to happen," she said.
'Not winner takes all'
A member of the powerful Hawiye clan, Mohamud entered politics in 2011 when he founded the Union for Peace and Development Party.
Few expected the bookish activist to become president and his 2012 election victory raised hopes that the fragile nation was on the path to stability.
His government was the first to be given global recognition and billions in foreign aid since the collapse of Siad Barre's authoritarian regime in 1991.
But the technocrat's term was marked by corruption scandals and political turmoil.
Two of the three prime ministers he appointed were forced out because of disagreements with him, while two central bank governors quit their jobs as graft allegations swirled around his administration -- claims he dismissed.
By the time his term came to an end, his administration was widely seen as more corrupt than any other that had come before, prone to wrangling over jobs, cash and power.
"The problem with his presidency was the teams around him sometimes engaged in graft... but in the conversations that he's been having with people he's indicated that things have changed," Gaid said.
Born in 1955 in Jalalaqsi in the central Hiran region, Mohamud studied at Somalia's national university before civil war broke out in 1991 and then at Bhopal University in India.
He worked with the UN children's agency UNICEF before co-founding the Somali Institute of Management and Administrative Development (SIMAD) in 1999.
Prior to joining politics, he spent two decades working in education and in conflict resolution -- the latter is likely to prove a useful skill in his second term.
"It's not winner-takes-all with him. I think that's exactly what Somalia needs right now," Gaid said.