Somalia has a new, apparently popular president. His main challenges include making federalism work, reducing corruption and improving security.
Somalia's complicated electoral process is finally complete and the country's new big cheese has his work cut out.
Mohamed Abdullahi Mohamed - known by the nickname Farmajo - is a technocrat, a former prime minister who served just eight months in office, but is a popular choice judging from the response to his victory on the streets.
There was celebratory gunfire punctuating the night sky across Mogadishu, as the results from the secured voting hall at the highly fortified airport were broadcast to the nation.
His nickname (derived from the Italian word for cheese - formaggio) was apparently inherited from his father rather than from a childhood love of Italian cheese as has been reported, but that's perhaps a question for his first news conference.
Mr Farmajo wasn't favourite to win the presidential election - in some quarters he was one of the least fancied of the main contenders.
Somalis may share one ethnicity, language and religion, but years of war have hardened the domination of society and politics by a complex family tree of clans, sub-clans, and sub-sub clans, and the differing loyalties and rivalries between them.
Members of the Hawiye clan have dominated political leadership in Mogadishu for many years, and although presidents in Somalia don't tend to win second terms in office, another Hawiye choice was available.
By selecting a Darod from the more northern regions of Somalia, MPs from the upper and lower houses decided to vote for even greater change.
Having joint American and Somali nationality, Mr Mohamed returned from the US only last year to announce his candidacy.
He was first posted to the Somali embassy in Washington in the 1980s and was studying in the US when the civil war started in 1991 and he claimed political asylum.
Five things about Mohamed Abdullahi Mohamed:
- He is a dual Somali-US national
- Father of four, with family still in the US
- His nickname, Farmajo, is derived from the Italian word for cheese, formaggio
- Graduated from the University of Buffalo in New York state with a degree in history and master's in American studies
- Was working for the transportation department in Buffalo when he was asked to return to Somalia as prime minister
He was a popular prime minister during his brief tenure in 2010 and 2011, with a reputation for making sure soldiers were paid their monthly salaries.
And with state finances allegedly being diverted to fund an expensively corrupt electoral process they will be hoping to jump to the front of the queue.
Strengthening the national army and police force - in the new federal state that Somalia has become - will be probably his first challenge.
"The real question is whether he is able to work with the federal member states or not," said Matt Bryden from the Somali-focused research organisation Sahan.
"If he is, then Somalia will move in the right direction and the institutions of government will broaden and deepen their legitimacy.
"If he finds himself at odds with the federal member states then there could be political tension or possibly crisis, and we could lose a lot of time in building relations between the regions and the centre."
Seen by some as a nationalist and a centrist while prime minister, the success of what's become a firmly federal project will depend on a change of heart.
Devolution of power was strengthened through the electoral process with the selection of parliament's upper house by federal member states.
But there are unanswered questions over how state income will be distributed from port taxes or natural resources like oil.
And the big failure of federalism so far has been security, and the inability of the central government to form a national army or police force that is trusted across the country and can effectively counter the threat of militant group al-Shabab.
The Islamists have shown a growing capability during the electoral process - bigger suicide bombs and complex armed attacks in Mogadishu, as well as large-scale attacks on foreign military bases in the countryside.
But they failed to stop the electoral process.
The regional African Union intervention force, Amisom, has kept al-Shabab at bay, but troop-contributing countries are setting deadlines to leave.
Foreign troops can clear al-Shabab out of towns and villages, but an insurgency can be beaten only if the vacuum left behind is filled - through the Somali government providing justice, rule of law and services such as health care and education.
"The fight against al-Shabab is really about building state structures and government," said Sahan director Matt Bryden.
"The regional forces and the clan militia are doing the heavy lifting. It's not being done by Somali national army or federal police, and there's a need to adjust the international investment in the security sector to align it with reality."
There's been a difference of opinion within the international actors in Somalia over whether to support centrally run security forces, or those delegated to the regions, where outsiders are not trusted.
Corruption is something which needs to be tackled with a firm hand.
Marqaati, a Somali non-governmental organisation focusing on corruption, has criticised the electoral process.
"The year 2016 was the worst year for accountability in Somalia as political actors sought to use whatever means possible to win the indirect elections process," its recent report began.
It claimed some presidential candidates paid $50,000 to $100,000 to MPs to secure their vote.
There are many accounts and accusations of money being paid in exchange for votes, with a statement from the US, EU and UN before the poll criticising the lack of accountability.
It was hoped that appointing more than 14,000 delegates to choose the 275 members of the lower house of parliament would restrict how much money was ploughed into politics, but it may have just increased the amounts involved.
Even the UN's special representative for Somalia, Michael Keating, admitted there were problems.
"It's not really a normal election, it is a political process with important electoral features," he told the BBC.
"Somalia doesn't have the infrastructure that you need to have one person, one vote elections. So inevitably it is very difficult to control money flows.
"The process has definitely been flawed in some ways - in many ways - but the result I hope will justify the effort that has gone into it," he said.
"There hasn't been a one person, one vote election here since 1969."
And that's another of the challenges facing the new president - ensuring there's a path towards full, democratic elections in four years' time.