By the end of Sunday, Somalis should know who their next president is, but this long-delayed vote only involves the country’s 328 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.
Four of the 36 candidates have made it through to a second round of voting, which is taking place now.
Said Abdullahi Deni, president of the northern, autonomous Puntland state – 65 votes
President Mohamed Abdullahi “Farmajo” – 59 votes
Former President Hassan Sheikh Mohamud- 52 votes
Former Prime Minister Hassan Ali Kheyre – 47 votes
As the first-round votes were being counted, mortar shells are said to have landed close to the airport. It is not yet clear if there were any consequence.
The winner will have to deal with the impact of the ongoing drought, in which 3.5 million Somalis are at risk of severe famine, according to the UN.
But the big task he – the four remaining candidates are all men – faces 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.
How does the voting work?
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 are choosing the next president were themselves elected by delegates nominated by the country’s powerful clans.
They are gathered 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.
The voting, done by secret ballot, was delayed for hours due to lengthy security checks.
Both houses of voted in the first round, with the top four candidates progressing to a second round.
If there is no clear winner, there will be a third round of voting.
There are 329 members of vote but one MP did not because his seat is contested.
Past elections were marred by claims of vote-buying with reportedly offering money in exchange for support.
The only female candidate, former Foreign Minister Fawzia Yusuf Adam, was eliminated in the first round of voting.
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, affecting up to 20 million people.
In Somalia, 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.