It is the first U.S. military combat death in Somalia since 1993.
U.S. forces were conducting an advise-and-assist mission about 40 miles west of Mogadishu, Somalia's capital, with members of the Somali National Army when the group came under attack in the middle of the night.
U.S. and Somali forces were attacked at some point after arriving by helicopter to the target location, a compound that housed a group of al-Shabaab militants associated with an attack on facilities nearby used by Somali and U.S. military forces.
“We helped bring them in there with our aircraft,” Pentagon spokesman Capt. Jeff Davis told reporters today. “We were there maintaining a distance back as they conducted the operation, that’s when our forces came under fire and we had the unfortunate casualty.”
U.S. and Somali forces were ultimately able to return fire and suppress the attack, a U.S. official told ABC News.
No Somali forces were hurt but a Somali interpreter and two U.S. service members were injured.
The United States has about 50 military personnel in the country, Davis said.
The mission was not being carried out under the new expanded authorities granted by the Trump administration for the U.S. military to conduct offensive counterterrorism airstrikes in Somalia targeting al-Shabaab, according to the U.S. official.
"Al-Shabaab presents a threat to Americans and American interests," U.S. Africa Command said in a statement on Friday. "Al Shabaab's affiliate, al-Qaeda has murdered Americans; radicalizes and recruits terrorists and fighters in the United States; and attempts to conduct and inspire attacks against Americans, our allies and our interests around the world, including here at home.
"U.S. forces are assisting partner forces to counter al-Shabaab in Somalia to degrade the al-Qaeda affiliate's ability to recruit, train and plot external terror attacks throughout the region and in America," the statement added.
Al-Shabaab is the largest faction working to topple the Somali government, seeking to establish a society based on Islamic law, known as Sharia.
Ultimately, al-Shabaab decided not to affiliate itself with ISIS, although a small faction did break away and pledge its allegiance.