One United States Service member has been killed and two injured during a joint operation with Somali forces outside Mogadishu, as the US steps up its fight against Al-Qaeda-linked extremists.

The soldiers where on an "advise and assist" mission against al-Shabaab when the service member was struck by small arms fire, the US Africa Command said in a statement Friday.

"On May 4, one US service member was killed during an operation against al-Shabaab near Barii, Somalia, approximately 40 miles west of Mogadishu," the statement said, adding the US forces were "conducting an advise and assist mission alongside members of the Somali National Army."

A Somali intelligence official told Associated Press that US forces in helicopters raided an al-Shabab hideout near the Somali capital on Thursday night and engaged with fighters.

The official, who spoke on condition of anonymity because he was not authorised to speak to the media, said the helicopters dropped soldiers near Dare Salaam village in an attempt to capture or kill extremists in the area. The official said the fighters mounted a stiff resistance against the soldiers.

The attack comes as US regular troops are returning to Somalia for the first time since 1993 when 18 special forces died fighting militias in Mogadishu, a battle dramatised in the film Black Hawk Down.