Holding high portraits of the man who pledges to bring the nation together, Somalis in the capital hailed their new president Thursday, singing in joy while soldiers fired weapons skyward in celebration.
Such scenes are unusual in the city, where security is a constant concern due to attacks from Al-Qaeda-linked Al-Shabaab militants who control many regions of the country.
After decades of corruption and strife the incoming leader, Mohamed Abdullahi Mohamed, faces a huge task rebuilding a battered state.
But those who took to the streets have placed their faith in the 55-year-old former prime minister nicknamed Farmajo (from formaggio, or "cheese" in Italian).
"This man will not only bring good governance but he will also unite the Somalis, he is the president of the people and we support him," said local resident Idris Sharif of the new leader.
Farmajo served as premier for only eight months between 2010 and 2011, before being ousted. However several steps he took, such as ensuring regular pay for soldiers, were well received and many protested against his removal.
Soldiers and police were among those optimistic about Farmajo's victory after incumbent president Hassan Sheikh Mohamud acknowledged defeat after a second round of voting by lawmakers on Wednesday.
"If you look back at what he did during the short time he was prime minister, I think he could be the right guy," Abdulahi Duale, a grocer on southern Mogadishu's Maka Al-Mukarama road told AFP.
Farmajo, from the Darod clan, in his victory speech spelled out the wrongs that have to be righted for Somalia to reverse its failed state reputation.
"People are very excited... hoping the new president will at least make sure the security forces get their salaries. If he succeeds in that then it will help the fight against Al-Shabaab," said Said Ali, another shopkeeper in the capital.
But not everyone shared the enthusiasm and hopes of reform.
"I did not support him during the election campaign," Jawahir Ali, a nursing student at university, told AFP.
"Somalis are full of sentiment which makes them blindly support Farmajo but let's wait, I'm sure time will come when they start cursing him," she said. "Many people think he will bring changes but let's wait and see what changes will come."
Farmajo also ran for president in 2012, the first election in the country since 1991 though only 135 clan elders picked the lawmakers who went on to elect the president.
In 2016 Somalis were promised a one-person, one-vote poll but political infighting and insecurity saw the plan ditched for a limited vote running six months behind schedule.
In the end only 14,000 delegates were allowed to vote for the lawmakers who picked the president. Some citizens spoke of pitfalls that lie ahead for Farmajo, pointing to Somalia's clan structure. While he is of the Darod clan the man he defeated is from the Hawiye, a clan that has had several recent presidents.
"We have to wait and see who he is going to pick as prime minister," said Mohamed Adan, a school teacher.
"The Hawiye clan lost the presidency yet they are the dominant clan in Mogadishu and they could become an obstacle if they feel disengaged.
"Some violent politics can exploit clan policies... and this could be more dangerous than any other situation," he added.
Despite Farmajo's win, the underlying reality is that the federal government controls only part of the country, helped by a 22,000-strong African Union Mission in Somalia (Amisom) force. The Shabaab holds large areas in the centre and south, and in the past 12 months they have multiplied their murderous attacks in the capital and at Amisom bases.
Somalia is also suffering its worst drought since 2010-2011, affecting an estimated three million people.
Farmajo, however, will start the job with his stock high according to Rashid Abdi, Horn of Africa programme director at International Crisis Group, which monitors conflict.
"The reactions we see in Somalia show he is very popular, he has credibility, also across the clan divide. But being popular is one thing, and being efficient is a very different one," he said.