A United States service member was killed Thursday and two injured in Somalia during an operation against the extremist group al-Shabab, the US military said Friday.

The mission was part of US efforts to step up its fight against the al-Qaeda-linked organization.

The service member was a Navy SEAL, a Department of Defense official told the New York Times, and was killed near Barii, about 40 miles west of the Somalian capital, Mogadishu, a statement from the US Africa Command (AFRICOM) said.

They were ambushed by fighters, reports NBC, and the attackers were 'neutralized'.

A United States service member was killed Thursday in Somalia during an operation against the extremist group al-Shabab; Gen. William 'Kip' Ward, then-Commander of the US Africa Command, is shown here with Sailors during the establishment of a US military harbor security force at the Port de Djibouti in August 2008

'The service member was struck by small arms fire while conducting an advise and assist mission alongside members of the Somalia National Army,' Mack said.

The injured service members are receiving proper medical attention, she said.

They were taken to neighboring Djibouti for care.

Both the United States and Somalia in recent weeks have declared new efforts against al-Shabab.

President Donald Trump has approved expanded military operations against the extremist group, including more aggressive airstrikes and considering parts of southern Somalia areas of active hostilities.

US forces in helicopters raided an al-Shabab hideout near the Somali capital on Thursday night and engaged with fighters, according to a Somali intelligence official who confirmed the US military operation.

The service member was a Navy SEAL and was killed near Barii, about 40 miles west of the Somalian capital, Mogadishu

The official, who spoke on condition of anonymity because he was not authorized 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 fighters mounted a stiff resistance against the soldiers, the official said.

Somalia's new Somali-American president, Mohamed Abdullahi Mohamed, last month declared a new offensive against al-Shabab, which is based in Somalia but has claimed responsibility for major attacks elsewhere in East Africa.

Also last month, the US military announced it was sending dozens of regular troops to Somalia in the largest such deployment to the Horn of Africa country in roughly two decades.

Both the US and Somalia have recently declared new efforts against al-Shabab; Somalia's President Mohamed Abdullahi Farmajo (L) is shown here in Addis Ababa, Ethiopia on May 3; US Marine Corps General Thomas D. Waldhouser (R), commander of the US Africa Command, is shown here in an undated photo provided by the US Department of Defense

AFRICOM, led by US Marine Corps General Thomas D. Waldhouser, said the deployment was for logistics training of Somalia's army.

The US in recent years has sent a small number of special operations forces and counter-terror advisers to Somalia and has carried out a number of airstrikes, including drone strikes, against al-Shabab.

The extremist group, which was chased out of Mogadishu years ago but continues to carry out deadly attacks there, has vowed to step up the violence in response to the moves by Trump and Mohamed.

Pressure is growing on Somalia's military to assume full security for the country as the 22,000-strong African Union (AU) multinational force that has been supporting the fragile central government plans to leave by the end of 2020.

The US military has acknowledged the problem. The AU force will begin withdrawing in 2018. If it leaves before Somalia's security forces are capable, 'large portions of Somalia are at risk of returning to al-Shabab control or potentially allowing ISIS to gain a stronger foothold,' Commander General Waldhauser has said.

Fighters linked to the Islamic State group are a relatively new and growing challenge in the north of the country, which has seen a quarter-century of chaos since dictator Siad Barre fell in 1991.

The US pulled out of Somalia after 1993, when two helicopters were shot down in Mogadishu and bodies of Americans were dragged through the streets.