Warlords whose forces have been fighting in the Somali capital, Mogadishu, have agreed a ceasefire to end three days of fighting.
The BBC's Mohamed Olad Hassan says the gunfire can no longer be heard and the city is returning to normal.
The latest fighting left some 60 people dead and dozens more were killed earlier this month in the worst clashes in Mogadishu for several years.
There has been no central government in Somalia since 1991.
Rival factions of the Abgal clan were fighting for control of the two functioning ports and an airstrip in the north of the city.
Prone to instability
Militia armed with automatic rifles, mortars and anti-aircraft guns exchanged intense fire throughout Saturday.
As well as forcing thousands of people to abandon their homes in search of safety in the southern part of Mogadishu, the fighting has driven up the price of food and other basics.
BBC Africa analyst Grant Ferrett says the clashes again highlight how prone Somalia remains to instability.
With no functioning national government, police or courts since President Siad Barre was overthrown, there is little to restrain the various militia groups.
Somalia's faction leaders have been meeting in neighbouring Kenya for more than 18 months in an effort to produce a new government, but there are widespread and understandable doubts in Mogadishu whether the men who have helped to destroy the country can agree to rebuild it.