Somalia's main warlords and politicians have signed an agreement to establish a new national parliament that in turn will elect a president.
Hopes are high that the war may soon be over
The deal paves the way for the setting up of the first recognised national government in Somalia for 13 years.
Since the fall of President Siad Barre, Somalia has had no central authority and been wracked by civil war with rival factions battling each other.
The talks in Kenya's capital, Nairobi, are the 14th attempt to secure a deal.
Correspondents say the international community has been putting pressure on the Somali faction leaders to agree a peace deal and this now seems to have borne fruit after more than a year of discussions.
Life is difficult for ordinary Somalis - with no government provision of services like health and education. Many have fled abroad.
For those that stay, there is always the risk of getting caught up in gun-battles which erupt between factions competing for control of each other's areas.
The new parliament will be made up of 275 members, rather than 350 as previously agreed and traditional elders will be involved in selecting them, as well as warlords, reports say.
The idea is that each of the four major clans will select 61 MPs and a coalition of small clans will select 31.
The task of selecting who will become an MP is left to each group, but this could be a lengthy and contentious process.
Once a parliament is eventually formed, then it chooses a president who in turn will nominate a prime minister to form a government.
Kenyan Foreign Minister Kalonzo Musyoka says he hopes there could be a functional government in Somalia within a month.
But with many ambitious warlords all eyeing the top prize, the hard negotiating is still to come.
Last week, mediators warned that tension between the self declared republic of Somaliland the autonomous region of Puntland could threaten the talks.
Somaliland's leaders are the one group which is not party to the latest agreement.
There has also been an upsurge in fighting in recent weeks in central Somalia.