African Union troops have fought house-to-house battles with militants in Somalia to clear space for aid groups bringing in food supplies after intelligence reports showed insurgents reinforcing for a possible attack on squalid camps of famine refugees.
Heavy fighting erupted on the line of control between the government side and territory held by al-Shabab, Somalia's dominant militant group.
At least six people were killed. The AU troops also paid a heavy price, with one official saying 19 were wounded, and some of them were put on an ambulance jet bound for Kenya.
Somalia's famine is unfolding in the middle of a war zone, greatly complicating international efforts to prevent a wave of death. Some 2.2 million people live in an inaccessible famine zone controlled by the al Qaida-linked al-Shabab.
The house-to-house fighting was only 2.5 miles from the nearest famine refugee camp, said Lieutenant Colonel Paddy Ankunda, spokesman for the African Union peacekeeping force.
The offensive, he said, was to ensure the city streets are safe for aid groups to get humanitarian supplies to the more than 20,000 famine refugees who have arrived in Mogadishu this month alone.
"The agencies have been trying to deliver. Unfortunately, al-Shabab has been bent on ensuring this aid does not reach the people," he said. "This operation is about the delivery of humanitarian aid."
Al-Shabab's decision last week to rescind permission allowing aid groups to operate in areas under militant control has denied hundreds of thousands of Somalis access to food aid, he said.
Mr Ankunda added that al-Shabab has sent 300 reinforcement fighters to Mogadishu in recent days.
Refugees have said militants already killed men who tried to flee famine-hit regions of Somalia with their families, saying it is better to starve than accept help from the West. African Union intelligence reports have indicated there could be attacks on Mogadishu's patchwork of ad-hoc refugee camps.