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.
AU FORCE IN SOMALIA Uganda: 1,700 Nigeria: 850 Burundi: 1,700 Ghana: unconfirmed
Q&A;: Somali conflict Have Your Say
"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.
Somalia. 

Ugandan troops arriving in Somalia as part of an African Union (AU) peacekeeping force, came under attack even before they went on patrol.

The Ugandan troops, 400 of whom arrived on Tuesday and another 400 the day after, were deployed to the capital Mogadishu as replacements for Ethiopian troops to support the Transitional Federal Parliament (TFP). 

Ethiopia intervened to help the TFP oust the Islamic Courts Union (IUC), which had held power for six months.

"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.

Somalia's Deputy Defense Minister Salad Ali Jelle said the Ugandan troops suffered no casualties. There were 10 civilians killed in the attack.

Assane Ba of the African Union said: "The AU has promised to deploy in Somalia and in Mogadishu. The attacks and threats do not set back the deployment."

A Mogadishu radio station broadcast a message from IUC member and Hizbul Shabaab leader, Aden Hashi Ayro, calling for attacks on the peacekeepers. "It is time for the Somali youth to fight the occupation by Ethiopia and others. The Muslims shall not surrender to non-believers."