After years of violence and chaos in the capital, some residents greeted the government soldiers while others hid.
"We are in Mogadishu. We are coordinating our forces to take control of
Mogadishu," said Prime Minister Mohamed Ali Gedi after meeting with local clan leaders to discuss the handover. Dozens of leaders agreed to help collect weapons from the militias still remaining in the city.
Ethiopian Prime Minister Meles Zenawi said he hoped fighting would be over in days and vowed to inflict total defeat on the movement known as the Council of Islamic Courts.
"We are discussing what we need to do to make sure Mogadishu does not descend into chaos," Zenawi said. "We will not let Mogadishu burn."
The movement held the capital for six months as part of an attempt to establish a government based on the Quran.
After the Islamic militias left Mogadishu early Thursday, local clan militiamen looted the city. Because Somalia's political system is historically based on clans, their leaders will have the largest influence over what happens next in the capital.
Forces from Ethiopia -- a country with a large Christian population -- entered Somalia to back the interim government after the Islamic movement began to march on the final stronghold of the U.N.-sanctioned Somali government in Baidoa. Ethiopia and the United States claim that members of the terrorist group al-Qaida hold key positions in the Islamic movement. The conflict, which also includes Eritrea's support for the Islamists, has threatened to further destabilize the Horn of Africa.
The movement's leaders encouraged foreign Muslims to join their fight against Ethiopia, though after fleeing Mogadishu, only the most hardcore fighters remain, according to one Muslim who left Thursday.
Some of the Islamic fighters ditched their uniforms for civilian clothes.
"We have been defeated," one former fighter told Reuters. "Many of our leaders have fled."
After leaving Mogadishu, the militias promised to defend their stronghold in the south and said they fled the capital to spare civilian deaths.
The courts chased U.S.-backed warlords from the city in June and continued their advance spreading Sharia or Islamic law through the southern part of Somalia. In September the council took Kismayo, a port city south of Mogadishu and began recruiting soldiers -- some of them as young as 12 -- to fight on behalf of the courts.
The Somali government was set up by the United Nations two years ago as an interim government but has been unable to rise above clan rivalries. The country has lacked an effective central government since longtime dictator Mohamed Siad Barre was ousted in 1991 by clan-based warlords who then turned on one another.