At least nine Somalis have been killed in a restaurant in the capital, Mogadishu, in an attack aimed at newly arrived African Union troops.
African Union troops have still not deployed onto the streets
A BBC correspondent says insurgents fired a rocket-propelled grenade at an AU convoy but it missed the target.
A third contingent of 400 Ugandan troops has arrived, bringing the total to 1,200. The first group came under fire at their airport base on Tuesday.
The troops have been sent to back up Somalia's transitional government.
The mood is tense in the capital, with many shops and businesses shut and roadblocks preventing civilians moving about, especially in the south of Mogadishu.
The AU force is taking over from Ethiopian troops who intervened to help the government oust the Union of Islamic Courts (UIC), which had held power for six months and restored some order to the anarchic country.
But violence has escalated in the past two months, with dozens of people being killed by insurgents, and now the AU is being targeted.
"Convoys of Ugandan troops were ambushed as they were passing the main junction in Mogadishu, and they exchanged heavy gunfire with the insurgents," said Shino Abdukadir, an eyewitness.
The BBC's Mohammed Olad Hassan in Mogadishu says at least three civilians were wounded during the gunfight and the casualty toll at local hospitals may increase.
Unconfirmed reports say two Ugandan soldiers were injured when their car hit a land mine.
Call to attack
The AU said the deployment would continue, despite the threat.
"The AU has promised to deploy in Somalia and in Mogadishu. The attacks and threats do not set back the deployment," said the AU's Assane Ba.
However a Mogadishu radio station broadcast a call by a UIC commander, Aden Hashi Ayro, for attacks on the peacekeepers.
"It is time for the Somali youth to fight the occupation by Ethiopia and others," he said.
"The Muslims shall not surrender to non-believers," he added.
The BBC's Karen Allen in Uganda says the fear is that, just as happened in Sudan's Darfur region, the AU force might not have the numbers or resources to cope with the threat.
So far, the AU has managed to raise only about half of the 8,000 troops required. Burundi, Nigeria and Ghana are also expected to contribute.
The targeting of Ugandan troops by insurgents in Somalia could give other troop-contributing nations cold feet, derailing the mission, our correspondent adds.