A source from Somalia's security services told CNN that at least 25 Somali government troops were killed in the fight. Twelve Ugandan soldiers also were killed, Uganda's military spokesman Lt. Col. Paddy Ankunda confirmed.
The attack by the Somali terrorist group occurred on a remote African Union base in the town of Janaale. It was the largest loss sustained by the Ugandan contingent of the AU Mission to Somalia, or AMISOM, since 2012.
Ankunda told CNN by phone that 10 of the fallen soldiers' bodies had already arrived back in Uganda.
Other Western sources said that as many as 50 AU troops were killed.
The 22,000-strong, United Nations-backed AMISOM force consists of troops from Uganda, Burundi, Kenya, Ethiopia, Djibouti and Sierra Leone. It has been dealt serious blows in recent months in Al-Shabaab attacks. The terror group seems to be shifting tactics, moving from smaller, asymmetrical suicide-bombing attacks on civilian, government and military targets to larger and more sustained operations solely focused on smaller, remote AU bases.
A member of Al-Shabaab told CNN that the battalion behind Tuesday's attack is the same group of about 200 fighters who assaulted an Ethiopian convoy and a base predominantly held by Burundian soldiers in Leego, Somalia, in July. Those two attacks killed dozens of AMISOM troops. The fighters call themselves the Abu Zubair Battalion -- named after the Al-Shabaab leader (a.k.a. Ahmed Abdi Godane) who was killed by a U.S. drone strike in Somalia in September 2014.
Al-Shabaab says the attack was in retaliation for alleged AMISOM attacks on civilians.
The United States on Thursday condemned Al-Shabaab for its "brutality in its depraved efforts to destabilize Somalia and deny the people of Somalia the peaceful, prosperous future they deserve."
A Western source told CNN that the AMISOM had recently withdrawn their heavy weaponry from the Janaale base to be used elsewhere against the Islamic extremists.
The source says Al-Shabaab also destroyed two nearby bridges, trapping the Ugandan soldiers. Militants loaded a car with explosives to breach the perimeter of the base.
The source added that poor weather conditions prevented U.N. air assets from reaching the attack to help evacuate the wounded Ugandan soldiers.
The U.N. has been criticized for not providing funding for more air assets in the fight. The Ugandan military has had no troop transport or armed helicopters in Somalia. Because of damaged roads after more than 20 years of civil war, ground transportation is slow and unreliable, making it harder to respond quickly when remote bases such as Janaale come under attack.
Ethiopia and Kenya have attack and troop transport helicopters. Kenya also uses fighter jets to strike Al-Shabaab targets, and the U.S. uses drones at times to help with surveillance and launch missiles at high-value terrorist targets.