Somalian women wait with containers and baskets in hand to receive aid at a food distribution centre in Mogadishu on Saturday. ((Mohamed Sheikh Nor, file/Associated Press))

The UN food agency is pulling out of southern Somalia because of attacks on its staff and demands from armed militants that women be removed from the group.

The agency announced the pullout on Tuesday.

The World Food Program is moving its staff and supplies to northern and central Somalia, ending food distribution in six areas of the country's south that are mainly controlled by the al-Shabab Islamist group.

"Up to a million people that have been dependent on food assistance in southern Somalia face a situation that is particularly dire," WFP spokesperson Emilia Casella said in Geneva.

"It's up [to] the armed groups who control that area to provide the assurances that our staff will be safe and that humanitarian principles will be maintained," Casella said.

"We are hoping we can return, so we consider it a temporary situation."

At least four WFP staff have been killed over the past 18 months.

About three million people depend on food aid in Somalia, which has been hit by drought. The country only produces about one-third of the food it needs.

A spokesperson for the UN High Commissioner on Refugees, which is working in neighbouring Kenya, is monitoring the situation amid worries the WFP pullout could lead refugees to leave southern Somalia in favour of other parts of the country or bordering nations.