Fears are high that the Al-Qaeda linked Shabaab group will seek to disrupt the election by carrying out an attack on the capital.
Fears are high that the Al-Qaeda linked Shabaab group will seek to disrupt the election by carrying out an attack on the capital. Twin car bombs at a popular hotel left at least 28 dead two weeks ago.
Heavily armed security personnel patrolled the streets of the capital, while several main roads were blocked off with sand berms and residents of the capital were urged by Mayor Yusuf Hussein Jimale to stay indoors.
"My children did not go to school because of the election and my husband who works as a policeman had to stay on duty for the last three days. This thing is taking too long and people would be relieved if they could see an end to this drama," mother-of-four Samiya Abdulkadir said.
President Hassan Sheikh Mohamud is seeking re-election against 21 other candidates, after another dropped out Tuesday.
The troubled Horn of Africa nation, which has not had an effective central government in three decades, had been promised a one-person, one-vote election in 2016.
However political infighting and insecurity, mainly due to Shabaab militants who control swathes of countryside and strike at will in Mogadishu, saw the plan ditched for a limited vote running six months behind schedule.
The delayed electoral process began in October, with 14,025 specially chosen delegates voting for candidates for both parliament and a new upper house. In 2012, only 135 clan leaders chose the MPs who voted for the president.
Repeated delays meant the new lawmakers were only sworn in in December.
In a report on Tuesday, Somalia-based anti-corruption watchdog Marqaati said the elections "were rife with corruption".
The tortuous process to elect a president whose remit does not extend beyond the capital and a few regional towns, has left some disillusioned.
"I really don't care who becomes president. We just need to be free to attend to our business," said Qoje Siyad, a Mogadishu day labourer.
While falling well short of the election that was promised, the process is more democratic than in the past and is seen as a step towards universal suffrage, now hoped for in 2020.
Wednesday's voting will see members of the 275-seat parliament and 54 senators cast ballots inside a hangar within the heavily-guarded airport.
Security sources said commercial flights would not be operating Wednesday.
No candidate is expected to get the two-thirds majority needed for a first-round win, with two further rounds permitted before a winner is declared.
In the absence of political parties, clan remains the organising principle of Somali politics.
The 22 candidates -- all men after the only declared female candidates dropped out -- paid a $30,000 (28,000-euro) registration fee. Few have any serious chance of winning.
One of them is the current president, a 61-year-old former academic and civil society activist from the Hawiye clan.
Also in the running is ex-president Sharif Sheikh Ahmed, a fellow Hawiye and 52-year-old former leader of the Islamic Courts Union which pacified Somalia before being driven out by US-backed Ethiopian troops.
The leading candidates from the Darod clan are Prime Minister Omar Abdirashid Ali Sharmarke, 56, and former premier Mohamed Abdullahi Mohamed 'Farmajo', 55.
Both hold dual nationalities having lived for years in Canada and the US respectively.
The overthrow of president Siad Barre's military regime in 1991 ushered in decades of anarchy and conflict in a country deeply divided along clan lines.
The clan rivalries and lawlessness provided fertile ground for the Shabaab to take hold and seize territory, frustrating efforts to set up a central administration.
The Shabaab has been in decline since 2011 but still launches regular, deadly attacks against government, military and civilian targets in the capital and elsewhere.
Security and overcoming Somalia's adversarial and divisive politics will top the agenda for whoever wins the vote as will dealing with a growing humanitarian crisis.
The UN warned last week of "possible famine" in Somalia as a severe drought has pushed nearly three million people to the edge of starvation.
After two failed rain seasons, aid workers fear a repeat of a 2010-11 drought which left more than 250,000 dead.