Somalia's prime minister entered the capital Friday, a day after an Islamic movement's fighters retreated ahead of his Ethiopian-backed troops, and was welcomed by thousands of cheering residents of the battle-scarred city.
While the visit was meant to symbolize the government's victory, fighting was likely to continue. Clan divisions, hatred of Ethiopia and religious fundamentalism remain problems for the government to tackle.
Ali Mohamed Gedi drove into the southern part of the city in a heavily armed convoy of 22 vehicles, then toured Mogadishu's seaport amid tight security.
Trucks fitted with loudspeakers roamed the city, blaring patriotic music. Mogadishu for the last six months has been controlled by a group who tried to establish a government based on the Koran. Some of its leaders are accused of having links to Al Qaeda.
"The government will lead this nation to a bright future," Gedi told reporters after arriving in central Mogadishu. "Today is the beginning of a new life, new stabilization and a new future for Somalia."
His first task is disarmament and demobilization of the thousands of militiamen in the country, he said.
Even before the rise of the Islamists, Gedi's government had been kept out of Mogadishu by clan violence. There was an attempt on his life during a rare trip to the city in November 2005. He called for the international community to provide both humanitarian and technical support and for the U.S. to help "to rid terrorism from the region." He said the government will move to the capital when it is safe.
As Gedi arrived, several thousand demonstrators in one neighborhood took to the streets to protest the presence of Ethiopian troops in the capital. Protesters threw stones, burned tires and used cars to block a main road. The crowd was later dispersed.
Earlier, Ethiopian troops aboard tanks fired warning shots into the air after dozens of young men threw stones as the convoy traveled through the city.
Gedi drove through the international airport past Ethiopian tanks guarding the runway. Thousands lined the route, according to an AP reporter who was with Gedi.
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. Ethiopia and Somalia fought a bloody war in 1977.
"We will not run away from our enemies. We will never depart from Somalia. We will stay in our homeland," he said from the southern coastal port of Kismayo, where his forces retreated from Mogadishu.
Hundreds of foreign fighters, mainly Arabs and southern Asians and some wounded, were seen in Kismayo. Some of the Islamic movement's members espouse an extreme form of Islam, and the United States accuses it of harboring Al Qaeda terrorists.
Somalia's president vowed to take the fight to Kismayo.
"We are going to go there and confront them," Abdullahi Yusuf said. "If we capture them, we will bring them to justice."
Ethiopia's Prime Minister Meles Zenawi has said he will not give up the fight until extremists and foreign fighters supporting the Islamic movement had been crushed, predicting it would take a few weeks longer.
Ethiopian jets continued to buzz Jilib, a front line town 65 miles north of Kismayo that is at a crucial junction of rivers and roads.
Until now, the government has tried to rule from Baidoa, the only town it held before Ethiopian troops came to its aid less than two weeks ago.
"Now the difficult task of rebuilding the country begins," Gedi told an AP reporter who was traveling with him. "We want to restore law and order."
Gedi said he is ready to bring peace to the nation.
"I want to disarm the entire country's general population," he said. "Our people are sick of civil war and instability."
Before the Islamists established control, Mogadishu had been ruled by competing clans who came together to support the Islamic fighters. Now, the clans could return to fighting one another and may reject the government's authority.
Somalia's clans have been the basis of politics and identity here for centuries. The country has not had an effective government since 1991, when clan-based warlords overthrew a dictator and then turned on one another.
Somalia's complex clan politics have been the undoing of at least 14 attempts to install a government in this violent, anarchic nation. Gedi's government is riddled with clan rivalries, most notably between the young prime minister and elderly President Abdullahi Yusuf.
"The future of Somalia is very bleak and Somalis will share the same fate with Iraq and Afghanistan," Abdullahi Mohamed Laki, a Mogadishu resident, said Thursday. "The transitional government has no broad support in the capital."
The U.N. said Friday it will resume humanitarian food aid flights to the country this weekend. Fighting forced the U.N. to evacuate its international staff and halt assistance to 2 million people affected by the conflict and recent floods.
The African Union and the Arab League have called for Ethiopian and all foreign troops to immediately leave Somalia.