At least seven people have been killed and several wounded after a gunfight broke out at a camp for displaced people in the Somali capital.
Residents of the Badbaado camp, on the outskirts of Mogadishu, were queuing to receive aid when the violence happened.
It was not clear who was behind the shooting. Some reports said it was government soldiers or militia.
Hundreds of thousands of drought-affected Somalis have arrived in the capital seeking food.
About 100,000 refugees have reached the capital in the last two months alone.
"Five people died on the spot after militiamen opened fire to loot the food aid," Abdikadir Mohamed, a driver, told Agence France Presse.
"There was chaos and everybody was running for cover after the security escorting the food aid convoy exchanged fire with the armed gang. The food was looted," he said.
Some reports said that it was government soldiers who opened fire when the distribution of food aid got out of control.
"When people started to take the food then the gunfire started and everyone was being shot," camp resident Abidyo Geddi told the Associated Press news agency.
The camp, set up by Somalia's Western-backed government, is home to nearly 30,000 people. Many private militias, often politically connected, compete to guard or steal food in Mogadishu.
Somalia's Prime Minister Abdiweli Mohamed Ali visited the camp after the violence, saying he was "deeply sorry". He said an investigation would be opened and promised he would punish anyone found guilty.
An official with an aid organisation working alongside the World Food Programme (WFP) said the UN agency had brought some 300 tonnes of food for the displaced people at the camp, AFP reports.
A WFP spokesman confirmed to Reuters that food aid had been stolen from the camp.
"By all accounts, it got out of hand. It got a bit chaotic and looting of the food started," David Orr said.
Some Mogadishu residents reportedly escaped with food on their shoulders or in wheelbarrows. Government troops and residents generally sell the aid to local markets for cash.
More than 11 million people have been affected by the worst drought in 60 years in the Horn of Africa in what the UN Food and Agriculture Organization (FAO) has called "the most severe food security emergency in the world today".
In Somalia, a famine has been declared across several southern states.
The international aid agency Save the Children has condemned a decision by the African Union (AU) to postpone a pledging summit for the Horn of Africa crisis.
The AU said it was postponing the summit by two weeks because it needed more time for planning.
Getting aid into Somalia has been difficult because the al-Qaeda-linked al-Shabab group - which controls much of the south and central regions and parts of the capital - has banned some aid agencies from their territory.
The UN says that some 3.2 million people in Somalia are in need of immediate life-saving assistance - almost half the population.
It is the first time in 19 years that the country - which has been without a central government since 1991 - has experienced famine.