US special forces have been deployed in Somalia for years, training and supporting the Somali military against the al-Qaeda aligned Shabaab.
"On May 4, one US service member was killed during an operation against al-Shabaab near Barii, Somalia, approximately 40 miles west of Mogadishu," said a statement from the US Africa Command (AFRICOM), adding the US forces were "conducting an advise and assist mission alongside members of the Somali National Army."
AFRICOM spokeswoman Robyn Mack told AFP two US soldiers were also wounded.
"The service member was struck by small arms fire while conducting an advise and assist mission alongside members of the Somalia National Army. Two other US service members were wounded in the incident. They are both receiving proper medical attention," she said.
US special forces have been deployed in Somalia for years, training and supporting the Somali military in the fight against the al-Qaeda aligned Shabaab. Drone and missile strikes have also been used against Shabaab commanders and footsoldiers.
Since taking office President Donald Trump has signed a directive loosening the US military's rules of engagement in Somalia and authorised the deployment of dozens of additional regular troops from the 101st Airborne Division.
In 1993, during the last major deployment of US troops in Somalia, 18 US soldiers were killed in the capital Mogadishu in fighting against warlords and their clan militias. The incident was captured in the book and film 'Black Hawk Down'.
For the last decade the Shabaab has been fighting to overthrow the internationally-backed government of Somalia.