By the end of Sunday, Somalis should know who their next president is, but this long-delayed vote only involves the country’s 329 MPs and takes place in a heavily fortified area.
The unusual circumstances highlight Somalia’s security issues, as well as the lack of democratic accountability.
The capital, Mogadishu, is in total lockdown until Monday morning.
The winner among the record 39 candidates will also have to deal with the impact of the ongoing drought.
But the big task is to wrest control of much of Somalia from al-Shabab.
The al-Qaeda-linked Islamist militant group continues to dominate large parts of the country and carries out frequent attacks in Mogadishu, and elsewhere.
The federal government is backed in its fight against al-Shabab by the African Union, in the shape of some 18,000 troops, and the United Nations.
Somalia has not had a one-person-one-vote democratic election since 1969.
That vote was followed by a coup, dictatorship and conflict involving clan militias and Islamist extremists.
The instability is one of the reasons Somalia why has been unable to hold direct elections.
This is only the third time that the indirect election for president has been able to take place in Somalia itself. Previous ones were held in neighbor Kenya and Djibouti.
Who is running for president?
Among the 39 candidates are the current President, Mohamed Abdullahi “Farmajo”, two former presidents, Sharif Sheikh Ahmed and Hassan Sheikh Mohamud, and a former prime minister, Hassan Ali Kheyre.
These four, along with the President of Somalia’s Puntland region, Sa’id Abdullahi Deni, are considered to be the frontrunners.
Their manifestos focused on political stability, improving security and economic reforms.
Fawzia Yusuf Adam, a former foreign minister, is the only woman among those who want the top job.
How will the vote take place?
This vote was supposed to have happened last year when Mr Farmajo’s four-year term ended. But political differences and instability delayed the poll and the president in power.
The MPs who will choose the next president on Sunday were themselves elected by delegates nominated by the country’s powerful clans.
They will gather in a large airport hangar in the well-guarded Halane Camp. This is the main military base of the AU’s mission in Somalia (Atmis), as well as the home of diplomatic missions and aid agencies.
Voting will be by secret ballot and it is expected that there will be several rounds before one candidate emerges as the winner.
Those who drop out in each round may be able to act as king-makers, urging their backers to support another candidate.
Past elections were marred by claims of vote buying with candidates reportedly offering money in exchange for support.
What has al-Shabab said?
In previous elections, al-Shabab threatened and even kidnapped clan elders after condemning them for participating in what it saw as an un-Islamic poll.
This time around, its to the elections has been muted, with fears that its members or sympathis may have secretly sought more seats in a bid to the system from within.
The fear was publicly expressed by neighbor Djibouti’s President Omar Guelleh in 2020, when he was quoted as saying: “I fear we will end up with a parliament indirectly controlled by al-Shabab because they’ll have bought the support of some of the MPs.”
Some analysts felt Mr Guelleh was exaggerating the possibility of al-Shabab gaining a foothold in parliament, but there is no doubt that it is a major political force in Somalia.
What are the challenges facing the next president?
On top of the continued threat from al-Shabab and the need to somehow dislodge the militants, Somalia is suffering from a drought that has hit countries across the region.
It has sparked a humanitarian crisis in which 3.5 million Somalis are at risk of severe famine, according to the UN. Pastoralists who have lost their herds are coming into the towns and cities looking for a way to survive.
The country is also being affected by food and fuel inflation sparked by the war in Ukraine.
There is pressure to complete the constitutional process and ensure that the country has democratic elections in the next four years.
However, Somalia’s power-brokers agreed a long time ago that one-person-vote elections would be held by this year, and they failed to fulfill the promise.