Ten countries have been violating a United Nations arms embargo to send weapons to Somalia, according to a UN-commissioned report.
Islamist militias control most of Somalia
Seven countries - among them Iran and Syria - have supplied military personnel and weapons to the Union of Islamic Courts militia.
While three countries are helping arm Somalia's weak interim government.
The report is due to be discussed by a UN Security Council committee on Friday.
The countries arming the Islamists are Syria, Iran, Eritrea, Djibouti, Egypt, Libya and Saudi Arabia, according to the report.
Ethiopia, Uganda and Yemen are named as the countries supplying Somalia's interim government.
COUNTRIES ARMING SOMALIA
The report, by experts monitoring the embargo, also suggests that Iran may have tried to trade arms for uranium to further its nuclear ambitions.
Ethiopia and Eritrea are named as the biggest violators of the arms embargo in Somalia, where there has not been a proper government for more than 15 years.
"There is the distinct possibility that the momentum towards a military solution inside Somalia may spill over into a direct state-to-state conflict between Ethiopia and Eritrea, as well as acts of terrorism in other vulnerable states of the region," Reuters news agency quoted the report as saying.
Many of the countries named in the report reject the accusations.
In Nairobi, UN Secretary General Kofi Annan has appealed to the transitional government and the UIC to resume peace talks "very quickly".
"We have a very serious situation in Somalia," he told the conference on climate change.
UIC representatives are expected to meet regional leaders at an economic summit summit in Djibouti later.
What is most striking about this report is the detailed links between countries such as Iran, Syria and Lebanon and the Islamic Courts Union, says the BBC's Laura Trevelyan at the UN in New York.
For example, the authors say 720 Somali fighters went to Lebanon to help Hezbollah fight Israel in July.
Syria is said to have sent an aircraft full of guns to the Somali capital, Mogadishu.
Iran is reported to have sent three shipments of arms to Somalia between July and September.
One paragraph in the report says two Iranians were in Somalia looking into getting uranium in exchange for supplying arms.
No further details are offered. Iran wants uranium to further its nuclear programme, which it insists is peaceful, while western countries suspect Iran of wanting a nuclear bomb.