Somali government troops opened fire Friday on hungry civilians, killing at least seven people, as both groups made a grab for food at a United Nations distribution site in the capital of the famine-stricken country, witnesses said.

Witnesses accused government soldiers of starting the chaos by trying to steal some of the 290 tonnes of dry rations as aid workers tried to hand them out in the biggest camp in Mogadishu for famine refugees.

Then refugees joined in the scramble, prompting some soldiers to open fire, the witnesses said.

"It was carnage. They ruthlessly shot everyone," said Abdi Awale Nor, who has been living at Mogadishu's largest camp for those fleeing the famine. "Even dead bodies were left on the ground and other wounded bled to death."

David Orr, a spokesman for the UN World Food Program, said the food distribution started smoothly at around 6 a.m. but degenerated a couple hours later.

"We got reports of trouble, looting. The trucks were overwhelmed by a mob of people. There were reports of some shots fired," said Orr, who said he could not confirm any death tolls.

Another refugee, Muse Sheik Ali, also said that soldiers first tried to steal some of the food aid, and that other refugees began to take the food.

"Then soldiers opened fire at them, and seven people, including elderly people, were killed on the spot. Then soldiers took the food and people fled from the camp," he said.

Somali Prime Minister Abdiweli Mohamed Ali visited the camp after the violence and said he was "deeply sorry." Ali said an investigation would be opened and promised harsh punishment for anyone found guilty.

Worst-hit area controlled by al-Qaeda

The already mostly lawless capital has been made even more chaotic with the arrival of thousands of refugees fleeing drought in the south, the famine's epicentre. International groups face huge challenges in distributing food inside Somalia.

The worst-hit part of the country is a no-go area for many aid groups because it is controlled by al-Qaeda-linked insurgents, who deny there is a famine and who have allowed only some groups to enter.

More than 12 million people in the Horn of Africa are in need of immediate food aid. The UN says 640,000 children in Somalia alone are acutely malnourished. The UN has declared five famine zones in Somalia, including the refugee camps of Mogadishu.

Witnesses said two WFP trucks were delivering aid when the chaos broke out. The food program often tries to do what it calls "wet feedings" in Somalia — giving out already made food like porridge — to limit the chances that it will be looted.

"They fired on us as if we were their enemy," famine refugee Abidyo Geddi said. "When people started to take the food then the gunfire started and everyone was being shot. We cannot stay here much longer. We don't get much food and the rare food they bring causes death and torture."

Private militias — most of them politically connected — are competing to guard or steal food. At least four competing militias have the run of government-controlled areas of Mogadishu.

The gunmen roar around in pickup trucks and wage battle over the wages they hope to be paid to either guard the aid or for the cash it will bring when it is stolen and sold. The insecurity amid famine echoes the situation in 1992 that prompted deployment of a U.S.-led multinational force to safeguard the delivery of food to Somalia's starving.

That international intervention collapsed in 1993 after two U.S. Black Hawk helicopters were shot down and militias hired to protect the aid operations ended up looting vast amounts of food.

Humanitarian response must be civilian-led

There are 9,000 African Union soldiers in the capital, but their main mission is to fight al-Qaeda linked Islamists, not safeguard humanitarian aid.

The African Union peacekeeping force is willing to help safeguard aid deliveries, said Maj.-Gen. Nathan Mugisha, the former commander of the AU force. He urged international organizations to do more to feed the families in the places they secured.

"We have done our part, largely, in the security sector," said Mugisha, whose forces have clawed back government control in about half the capital's 16 districts. Five more are on the front lines and the rebels control three.

Many aid agencies fear that if they are seen to be working too closely with the AU force, their staff could be targeted for being spies.

"Humanitarian responses in Somalia must be civilian-led," said Mark Bowden, the UN's top official in charge of humanitarian aid in Somalia.

"In the highly politicized context of south-central Somalia, relying on military assistance will not be effective. It is important that aid is seen as being impartial and independent of all political action."