Somalia's government announced on Thursday that delayed elections would be held within 60 days, following months of deadlock over the vote that erupted into violence in the troubled country.
"About the schedule of elections, the national consultative forum agreed that elections will be held within 60 days" with the exact dates to be determined by the electoral board, deputy information minister Abdirahman Yusuf announced at the conclusion of talks.
The central government and leaders of Somalia's five states had been unable to agree on the terms of a vote before the president's term lapsed in February.
When the last round of UN-backed talks collapsed in April, the lower house of parliament passed a special bill extending by two years the mandate of President Mohamed Abdullahi Mohamed, better known as Farmajo.
The upper house rejected the move and anger at Farmajo spilled onto the streets of Mogadishu.
Rival militias traded gunfire and civilians fled, in the country's worst political violence in years.
The crisis ruptured Somalia's fragile security forces and stoked fears of outright civil war, with soldiers deserting their posts in the countryside to fight for their political allegiances in the capital.
Under domestic and international pressure, Farmajo reversed the mandate extension and ordered his prime minister to convene state leaders for a fresh round of talks, easing tensions as soldiers left the capital.
"It is a historic day today," Prime Minister Mohamed Hussein Roble said following five days of negotiations with state leaders.
"After days of discussions involving respect, patience and compromise, we have succeeded in reaching consensus over the disputed issues of the elections."
The election will follow a complex indirect model used in the past, whereby special delegates chosen by Somalia's myriad clan elders pick lawmakers, who in turn choose the president.