Sergeant Alexander Conrad, 26, a US special operations commando, died of injuries from "enemy indirect fire,” the US Defense Department said in a statement Saturday.
US Africa Command, which oversees US operations on the continent, said the American troops were on a training mission with local Somali and Kenyan forces when the attack occurred.
The US and local troops were part of a mission in the area tasked with clearing al-Shabab militants from contested areas and setting up a permanent combat outpost when they came under attack by mortars and small arms fire, US Africa Command said in a statement.
“The US provided advice, assistance and aerial surveillance during the mission,” it said, Presstv reported.
About 500 US troops are deployed in Somalia on a so-called advise and assist mission.
Al-Shabab militant group has intensified its deadly bombings in Somalia’s capital city of Mogadishu since the new government took office in February.
The long-chaotic nation located in the Horn of Africa has been the scene of deadly clashes between government forces and Takfiri al-Shabab militants since 2006.
African Union troops forced al-Shabab out of the capital in 2011, but militants still control parts of the countryside and carry out attacks against government, military and civilian targets in Mogadishu and regional towns.
Since last year when President Donald Trump approved expanded military efforts against the group, the US military has launched more than a dozen drone strikes against it.
Washington claims that it coordinates such drone strikes with the Somali government.