Updated

Jubilant Somalis cheered as government troops rolled into Mogadishu unopposed on Thursday, hours after an Islamic movement that had vowed to establish a government based on the Quran abandoned the capital.

But the jubilation may be short lived.

The Islamic movement pledged to fight on from the southern half of the country. Many in overwhelmingly Muslim Somalia are skeptical of the government's reliance on neighboring Ethiopia, a traditional rival with a large Christian population and one of Africa's largest armies. And Somalia's complex clan politics have been the undoing of at least 14 attempts to install a government in this violent, anarchic nation.

For more on the Islamic Militia battling for control of Somalia, and information on Africa, click here.

"We are in Mogadishu," Prime Minister Mohamed Ali Gedi declared after meeting with Somali traditional leaders to discuss the peaceful hand-over of the city.

He later said the government is seeking parliamentary approval to impose martial law across the country while its forces attempt to restore order. Weapons also will be confiscated, he said without giving details.

Gedi's government, set up in 2004 with U.N. backing, is riddled with clan rivalries, most notably between the young prime minister and elderly president.

"The future of Somalia is very bleak and Somalis will share the same fate with Iraq and Afghanistan," Mogadishu resident Abdullahi Mohamed Laki told The Associated Press. "The transitional government has no broad support in the capital."

A chilling reminder of the chaos Somalia has known came as armed militiamen began looting almost anything they could after the Islamic forces left. At least four people were killed in the melee, said witness Abdullahi Adow.

President Abdullahi Yusuf, whose government has spent a year in a temporary capital, Baidoa, 250 kilometers (150 miles) west of the capital, said Thursday that his troops were not a threat to the people of Mogadishu.

"The government is committed to solving every problem that may face Somalia through dialogue and peaceful ways," his statement said.

Click here for FOXNews.com's Africa Center.

Gunfire could be heard for most of the day in the city. The U.N. airlifted out 14 aid workers and one U.N. staff member because of deteriorating security.

Ethiopian troops, who had pledged not to enter the city, were stoned by local crowds on the northern edge of the city, witnesses said. "How could we welcome an invading enemy," said one protester, Faiza Ali Nur.

Ethiopia and Somalia fought a bloody war in 1977.

Ethiopia's Prime Minister Meles Zenawi vowed not to give up the fight until extremists and foreign fighters supporting the Islamic movement had been crushed.

"We need to pursue them to make sure that they do not establish themselves again and destabilize Somalia and the region," he said, predicting it would take a few weeks longer.

Speaking in the Ethiopian capital, Addis Ababa, he added that between 2,000 and 3,000 Islamic militia had been killed and 4,000 to 5,000 wounded.

Ethiopia suffered a few hundred casualties, Meles told reporters.

The Islamic forces, who had threatened to defend the capital to the last man, retreated toward the southern port of Kismayo.

Islamic fighters have gone door to door in Kismayo, recruiting children as young as 12 to make a last stand on behalf of the Islamic courts, according to a confidential U.N. situation report, citing the families of boys taken to the front line town of Jilib, 110 kilometers (65 miles) north of Kismayo.

Residents told the AP that Islamic leader Hassan Dahir Aweys had arrived in Jilib with hundreds of fighters aboard 45 pickup trucks mounted with anti-aircraft guns.

The Islamic movement took Mogadishu six months ago and then advanced across most of southern Somalia, often without fighting. Then Ethiopian troops and fighter aircraft went on the attack in support of the government last week.

The International Committee of the Red Cross said over the past few days, hospitals and other medical facilities in southern and central Somalia have admitted more than 800 wounded people.

"The ICRC is extremely concerned about civilians caught up in the fighting, wounded people and people detained in connection with the fighting," said Pascal Hundt, head of the ICRC's Somalia delegation.

The U.N. refugee agency said Thursday that two boats carrying Somalis and Ethiopians across the Gulf of Aden from Somalia late Wednesday capsized as they were being pursued by Yemeni coast guards, killing at least 17 people and leaving some 140 others missing, the U.N. refugee agency said Thursday.

The refugee agency said some of the 357 survivors claimed to be fleeing the fighting in central Somalia. But their boats were launched from far to the north in a relatively peaceful area of Somalia from which a steady stream of economic migrants has set sail in recent years.

Before the Islamists established control, Mogadishu had been ruled by competing clans who came together to support the Islamic courts. Now, the clans could return to fighting one another and may reject the government's authority.

The key will be the Abgal and Habr Gadir clans. The prime minister is from the Abgal clan, while many top leaders of the Islamic movement where from the Habr Gadir clan.

Somalia's clans have been the basis of politics and identity here for centuries. But due to clan fighting, the country has not had an effective government since 1991, when clan-based warlords overthrew a dictator and then turned on one another.

Click here for FOXNews.com's Africa Center.