Ugandan army spokesman Brigadier Richard Karemire said his army had "lost four gallant soldiers and six sustained minor injuries".
30 members of the terrorist group al-Shabab were killed by African Union troops on Sunday during a gunfight that lasted hours.
The attack started in the morning when two suicide auto bombs exploded at the entrance to the heavily fortified base in Bulo-Marer, an agricultural town in Somalia's Lower Shabelle region, said Somali army Col. Ahmed Hassan.
The Ugandan army said its troops serving in the 22,000-strong African force had killed 22 al-Shabab militants.
Almost 100 fighters firing propelled grenades and machine guns attacked the base occupied by the Ugandan soldiers.
Four Ugandan peacekeeping soldiers with the African Union (AU) have been killed by Al Shabaab extremists following an attack on a base in the south of Somalia, AP reported.
Al-Shabab claimed responsibility for the attack.
Although Amisom peacekeeping forces have eliminated the al-Shabaab Islamists in major towns, including the capital Mogadishu, the militants still control large parts of the countryside and often launch gun and bomb attacks on government, military and civilian targets.
The special representative of the chairperson of the African Union Commission for Somalia, Francisco Caetano Madeira, said in a statement that AMISOM troops had fought off and successfully pushed back al-Shabaab militants Sunday.
Two Somali intelligence officials told AP that the airstrike targeted a vehicle carrying senior al-Shabab officials and the dead included a woman.
Severe weather possible Tuesday
The cold front will sweep across the southeast Tuesday through Wednesday , arriving in Middle Georgia early Wednesday morning . The Storm Prediction Center has elevated us to the "Moderate" category for severe weather through the end of the day.
April storm drops wet, heavy snow on NY and Northeast
The bulk of the snow should fall between midnight and 3 a.m., said Trent Davis, meteorologist in Mount Holly, New Jersey . Monday's snowstorm was the fifth in the area after four nor'easters in March. 2 N 2 W of Swanton: 6.0 inches.
Nobel laureate Malala ends visit to Pakistan
In 2007, the militants had taken over the area, which Malala affectionately called "My Swat", and imposed a brutal, bloody rule. The visit was kept highly secret and hardly anyone knew until she landed in Islamabad and was driven in security to a hotel.