(CNN) -- Somali lawmakers are scheduled to choose the next president Monday, moving the nation a step closer to its first stable central government since the 1991 ouster of a dictator.
The new parliament, which was selected last month, will hold a ballot to choose the president from about two dozen candidates.
In a letter to lawmakers, the United Nations called for a credible leader who can propel the African nation toward peace.
"After two decades of civil war, a collapsed state and innumerable indignities to the proud Somali people, we are hours away from the election of a new president," said Augustine P. Mahiga, the U.N. envoy to the nation.
"The event that will completely end the transitional period and move us toward a phase of political and socio-economic transformation."
The scheduled vote is the latest in a series of political transitions in the nation.
In recent weeks, it has adopted a provisional constitution, held an inaugural meeting of its new parliament and appointed that body's speaker.
"It has not been easy getting us to this point," Mahiga said. "There have been moments when all seemed lost and we have sometimes been on the brink of despair."
Candidates include incumbent President Sharif Sheikh Ahmed, who has been in power since 2009, and his prime minister, Abdiweli Mohamed Ali.
Dictator Mohamed Siad Barre was overthrown 21 years ago, sparking years of warring militias and a transitional government that has remained shaky at best. Over the years, lawmakers have met in neighboring Kenya and Djibouti because of lack of security in Somalia.
African Union and Somali troops are battling Al-Shabaab militants, an al Qaeda-linked group that controls part of the nation's south.
In recent months, the troops have driven the militants out of Mogadishu, and the capital is slowly trickling back to normalcy. Coalition forces are exerting control in more areas, but it is not secure enough to hold a nationwide vote.
The militant Islamist group has waged an insurgency against the weak transitional government since 2007.