The Islamist militias control swathes of Somalia
The US has confirmed that it has sent weapons to Somalia's UN-backed transitional government.
The announcement follows an urgent call for military help from the government, which has been fighting Islamist militias accused of links to al-Qaeda.
The insurgents control swathes of Somalia and US officials have been alarmed at their gains, analysts say.
The US would also provide logistical support for training Somali troops, officials said.
"At the request of that government, the state department has helped to provide weapons and ammunition on an urgent basis," spokesman Ian Kelly said.
The unspecified quantity of arms would help the government "repel the onslaught of extremist forces which are intent on... spoiling efforts to bring peace and stability to Somalia", he added.
The US would also provide support for training Somali troops but would not conduct the training themselves, officials said.
Last week the Somali government called for urgent foreign military assistance to help battle al-Shabab and its allies but Ethiopia and Kenya both declined to send troops.
The US has previously backed several Somali groups fighting hard-line Islamist groups and carried out air strikes against alleged leaders.
But Horn of Africa analyst Roger Middleton says the government's main military problem is not a lack of weapons, or men to fight.
He told the BBC's Network Africa programme that government forces were formed from two main groups - those dating from the time of former President Abduallhi Yusuf and those who came with President Sheikh Sharif Sheikh Ahmed, a moderate Islamist former insurgent who took office in January.
Mr Middleton, from the Chatham House think-tank based in London, says the two groups do not work together very well.
He also points out that the announcement could be counter-productive.
"One of the charges by al-Shabab against the transitional government is that it is a stooge of the international community - it's hard to see how the public delivery of American weaponry will help President Sharif win the public relations war."
Somalia has been without an effective government since 1991.
Since 7 May, an alliance of militant Islamist hardliners has been locked in ferocious battles with pro-government forces in the capital, Mogadishu, forcing more than 165,000 people to flee their homes.