Inside the US military's mission in Somalia U.S. troops advise the Somali military in its fight against al-Shabaab.

 -- The death of a U.S. Navy SEAL in Somalia this week highlights the little-known mission that U.S. military advisers have been carrying out in that country: to advise the Somali military in its fight against the al Qaeda affiliate, al-Shabaab.

Since 2013 a small number of American troops have worked with military forces from the new Somali government to fight al-Shabaab, the extremist group that once ruled Somalia.

As part of their advise and assist mission, American special operations forces accompany Somali troops in raids against al-Shabaab. But they are not directly engaged in combat unless they find themselves in a self-defense situation.

Here is a closer look at the role American troops are playing in Somalia.

What Are U.S. Troops Doing in Somalia?

According to the Pentagon, there are about 50 American military personnel in Somalia, most of them special operations forces based in the capital city of Mogadishu. An equal number of conventional forces are currently in Somalia for a training mission lasting several months.

They are there to carry out an advise and assist mission with Somali government forces fighting al-Shabaab.

American military forces also work closely with African Union peacekeeping troops in Somalia. These troops support the Somali government in its fight against al-Shabaab.

The American forces help plan Somali military raids against al-Shabaab and then assist those forces when they carry out the raid.

They also provide the helicopters that transport the Somali troops to their targets. While they accompany the Somali troops on raids, American forces do not actively participate in the operation.

There have been several instances over the past year where some of these American forces have engaged in firefights in self-defense. Sometimes drone airstrikes have been called in to provide additional support.

In March, the Trump administration granted new authorities to U.S. Africa Command that allow the U.S. military to conduct unilateral offensive counterterrorism airstrikes against al-Shabaab if needed. Until then, the U.S. military had only been able to conduct airstrikes against al-Shabaab fighters in self-defense situations when African Union or Somali government troops accompanied by American advisers were under attack.

Friday's raid was not carried out under those new authorities, but was part of the ongoing advise and assist mission.

First U.S. Combat Death in Somalia Since 1993

The death of the Navy SEAL was the first U.S. military fatality in Somalia since the deadly "Black Hawk Down" incident in 1993 that killed 18 American service members. "Black Hawk Down" has become synonymous with the U.S. military intervention in Somalia. It was the title of a book and movie that recounted the deadly battle and rescue mission that resulted in the takedown of two American Black Hawk helicopters in Mogadishu by Somali militia fighters.

In late 1992, President George H. W. Bush ordered American troops into Somalia to enable the delivery of humanitarian aid intended to relieve a famine.

But that peaceful mission soon became tense as a United Nations peacekeeping force found itself in combat with forces loyal to Somali warlord Mohammed Aidid.

In early October 1993, elite U.S. special operations forces conducted a failed raid to capture Aidid, leading to the deaths of 18 American troops. President Clinton pulled American troops out months later.

The U.S. military did not formally return to Somalia until October 2013 when a very small number of advisers were sent to Mogadishu to assist African Union troops. The advisers' focus has shifted to the nascent military forces loyal to the new Somali government.