The UN Security Council has voted unanimously to extend the African Union peacekeeping mission in Somalia.
Just 1,700 Ugandan soldiers are on the ground in Somalia
The resolution also called on UN Secretary General Ban Ki-moon to continue planning a UN mission in Somalia to replace the AU troops.
South Africa's ambassador to the UN criticised the resolution, saying the AU forces were doing the UN's work.
More than 1,000 people died this year amid clashes between Islamist fighters and government-backed Ethiopian troops.
According to international medical charity Medecins Sans Frontieres (MSF), access to medical supplies and services has decreased dramatically in Somalia's capital Mogadishu over the past several months.
Somalia has been without an effective government since the civil war began in 1991.
The British-backed Security Council resolution called on African states to pledge more troops to the AU forces, which are desperately short of troops.
Just 1,700 Ugandan soldiers are on the ground in Somalia, despite the UN authorising an 8,000-strong AU peacekeeping force there.
Troop deployments from other African countries - including Burundi, Nigeria and Ghana - have been delayed by lack of funding and equipment.
The resolution urged Mr Ban "to continue to develop the existing contingency planning for the possible deployment of a United Nations peacekeeping operation".
It also threatened unspecified action against anyone violating the arms embargo in Somalia or seeking to derail the peace process.
But South Africa's UN ambassador, Dumisani Kumalo, said the AU "is doing a job that the UN is supposed to be doing".
"When your house is on fire, the neighbours come with a bucket of water," he said.
"But the neighbours are not the fire engine. The fire engine is the United Nations."
Last December, the interim government, backed by Ethiopia, ousted the Union of Islamic Courts (UIC), an Islamist group that had taken control of much of southern Somalia.
Since that alliance regained control of Mogadishu in April, Islamist insurgents and clan fighters have mounted regular attacks against government targets.
Christophe Fournier, MSF's international president, who recently returned from a visit to Mogadishu, said residents in the city are terrified to leave their homes to seek medical help, or are simply out of reach.
MSF found that six months ago there were 800 hospital beds available in the capital and now there are only 250; over the same period the number of doctors in the city's six hospitals fell from 53 to 13.
In the past month, malnutrition levels amongst children have fallen beyond emergency levels and in one camp 12 percent of children are so malnourished that they are at immediate risk of dying, the charity warned.
MSF is calling on all the parties to the conflict in Somalia to respect the work of medical staff and allow patients access to health facilities.
The UN says some 400,000 people have fled the violence in Mogadishu in the past four months.