Ugas Abd-dahil Ugas Mohamed, a prominent Somali elder, said on Wednesday: "The two sides have accepted the ceasefire proposed by traditional elders.
"The next stage of the negotiations will start on Thursday morning, which is the redeployment of militia back into their stronghold from the battle zone," he said after truce talks that were held in Peace Hotel in southern Mogadishu.
The clashes pitted gunmen backed by the Alliance for the Restoration of Peace and Counter-Terrorism (ARPCT) - a coalition of local commanders - against Islamic court militia.
Witnesses said skirmishes, along a road in southern Mogadishu's Daynile district, began on Saturday after the commanders launched the ARPCT. The initiative is thought to be backed by Washington.
At least 33 people were killed and hundreds wounded, thousands of families were displaced and dozens of houses ruined by bombs in the fighting, Mohamed said.
Another elder, Sultan Ali, said: "The mediation effort was accepted by both sides, and that will end the fighting in Mogadishu south from now onwards.
"The warring groups full-heartedly accepted the ceasefire, and any group that violates the ceasefire will be seen as criminals who want to continue killing innocent people," he said.
"Anybody who describes the violences as interclan fighting is lying"
Chief of Mogadishu's Joint Islamic Courts
Elders had earlier said the fighting was between the Mursade and Habergider subclans of the larger Hawiye clan. It was sparked by an attempt to bring southern Mogadishu under the full control of one of the two groups, which was rejected by the head of the Islamic courts, they said.
Sheik Shariff, the head of the influential Mogadishu Joint Islamic Courts, said: "It was the satanic alliance [warlords] that ignited the violence, fired the first shot and it is up to them if they want to stop the violence. The Islamic court has accepted the suggestion of elders.
"Anybody who describes the violences as interclan fighting is lying."