A US soldier has been killed in Somalia during operations against al-Shabab militants, the American military says.

Two other US servicemen were injured in Thursday’s incident, about 40 miles (64km) west of the capital Mogadishu, near the town of Barii.

American forces were on an “advise and assist” mission with the Somali National Army, the US military said.

President Donald Trump has expanded military action against the al-Qaeda affiliate in the Horn of Africa nation.

“On 4 May, one US service member was killed during an operation against al-Shabab near Barii,” US Africa Command said in a statement on Friday.

“US forces were conducting an advise and assist mission alongside members of the Somali National Army,” it added.

US Africa Command spokeswoman Robyn Mack said that the American soldier was struck by small arms fire.

She added that another two soldiers were wounded in the same incident and “they are both receiving proper medical attention”.

In Thursday’s mission, US troops were hunting an al-Shabab commander near the Shabelle river, Reuters news agency reports.

American presidents have been wary of intervention in Somalia since 18 special forces died fighting militias in Mogadishu in 1993, a battle dramatised in the film Black Hawk Down.

But in March, Mr Trump approved a Pentagon plan to escalate operations against al-Shabab, including additional air strikes.

Last month, dozens of American soldiers were deployed to Mogadishu to train and equip Somali and African Union troops.

It was the first time regular US troops had been sent to Somalia since 1994, though some counter-terrorism advisers were already there.

BBC Africa Security correspondent Tomi Oladipo says the soldier killed on Thursday would not be one of the soldiers recently sent to Somalia.