Mogadishu and surrounding areas are on lockdown after increase in al-Shabab attacks in lead-up to election.
Somalia's capital is on lockdown a day before the parliament meets to elect a new president, with ongoing security concerns and warnings of famine expected to top the agenda for the incoming administration.
Roads in Mogadishu were closed, businesses asked to shut, and schools and universities gave students a two-day break.
In the run-up to the election, al-Shabab fighters have stepped up their attacks against government installations and hotels in the capital.
Bishar Abshir, Mogadishu police chief, told Al Jazeera that security forces were working to ensure that the election is concluded peacefully.
"We appeal to the public to be patient and cooperate with us as we deter the enemies of peace from carrying out attacks," he told Al Jazeera.
Al-Shabab, which aims to topple the country's UN-backed government, has carried out hundreds of attacks in Somalia.
The presidential election had been due to take place in August, four years after the previous vote in which just 135 clan elders chose MPs who then voted for the country's leader.
But political infighting and insecurity, mainly due to al-Shabab, which controls swaths of countryside and strikes at will in Mogadishu, saw the plan ditched for a limited vote running months behind schedule.
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.
Elections instead began in October with an electoral college system that excluded ordinary citizens and instead involved 14,025 delegates voting for candidates for both parliament and a new upper house.
President Hassan Sheikh Mohamud of the conservative Peace and Development Party is seeking a second term after more than four years in office, during which he has faced criticism from the public and western donors about corruption.
Prime Minister Omar Abdirashid Ali Sharmarke, a former diplomat, and former president Sharif Sheikh Ahmed are also among the 24 candidates registered for the election.
About a third of MPs are loyal to the president's party. While this gives Mohamud an advantage in the race, it is not enough to guarantee him victory.
The elections have been marred by widespread allegations of vote-buying and intimidation.
In a report on Tuesday, Somalia-based anti-corruption watchdog Marqaati said the elections "were rife with corruption".
While falling well short of the direct 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.
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 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 al-Shabab to take hold and seize territory, frustrating efforts to set up a central administration.
Al-Shabab has been in decline since 2011, but still launches regular, deadly attacks against government, military and civilian targets in the capital Mogadishu 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 United Nations 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.
"The levels of suffering in the country, triggered by protracted conflict, seasonal shocks and outbreaks of disease, are typically hard to bear, but the impact of this drought represents a threat of a different scale and magnitude," the UN's office for humanitarian affairs said in a statement last week.