Mortar rounds slammed into Mogadishu's airport Tuesday during a ceremony welcoming peacekeepers, and a deadly gun battle ensued as authorities searched nearby homes for suspects.
Three people were killed in the gun battle and one was wounded in the mortar attack, witnesses said.
The violence is the latest example of the volatility the peacekeepers face in a country that has seen little but anarchy for years.
"I saw around 100 gunmen engaging a fierce battle," Hassan Abukar Sidow told The Associated Press. "They used heavy machine guns and rocket propelled grenades."
The attacks came as Ugandan peacekeepers arrived in Somalia's capital to protect the still-struggling transitional government and to allow for the withdrawal of Ethiopian troops who helped the government topple an Islamic militia.
The Ugandan troops are the vanguard of a larger African Union force authorized by the United Nations to help the government assert its authority. Ethiopian troops entered Somalia in late December, when an Islamic movement threatened to attack the government.
Two cargo aircraft carrying soldiers and armored vehicles landed at Mogadishu's main airport Tuesday and were welcomed by top government officials. Paddy Akunda, the Ugandan forces' spokesman, said 400 troops were on the ground so far in Mogadishu, with the remaining 1,100 expected in the next 24 hours.
"We are very happy to be the first African Union peacekeepers to Somalia. We are welcomed here," Akunda said. "We are not imposing anything on Somalis. We know our mandate; we will work toward restoring law and order in Somalia without targeting anybody."
Residents were not allowed inside the airport during the welcoming ceremony, Jelle said. Ethiopian and Somali troops have beefed up security in the capital.
In Uganda, Deputy Defense Minister Ruth Nankabirwa said the troops understand the dangers of working in Somalia.
"We have not just dropped our troops there without knowing the situation," she said.
Insurgents, believed to be the remnants of the Islamic movement that tried to seize power last year, have staged almost daily attacks against people associated with the government, its armed forces or the Ethiopian military.