One US soldier has been killed and two others have been injured outside a military base near the capital, Mogadishu, fighting the al-Qaeda-linked al-Shabab terrorists, the Pentagon has said.

The incident took place on Thursday near Barii, about 60 kilometers west of Mogadishu, while the US forces were carrying out an "advise and assist" mission with Somalia’s military. This is the first time since 1993 that the US military has suffered fatalities in the African country.

“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. No further information about their conditions is available at this time,” the US Africa Command spokeswoman said in a statement.

“US forces are assisting partner forces to counter al-Shabaab in Somalia to degrade the al-Qaeda affiliate's ability to recruit, train and plot external terror attacks throughout the region and in America,” Robyn Mack added.

This comes as Somalia has ramped up its operations against terrorist groups and particularly the al-Qaeda-linked al-Shabab militants.

The United States already has a small contingent of special operations forces in Somalia, allegedly aiding the war-torn country in fighting Takfiri terrorist groups; however, there have been reports of civilian casualties as a result of American military interference in the African nation.

Read More:

In March, US President Donald Trump approved a Pentagon plan to increase operations against al-Shabab, including additional air strikes. Last month, dozens of American troops were deployed to Mogadishu allegedly aimed at training the African country’s forces to confront terrorist groups.

Somalia has been the scene of deadly clashes between government forces and al-Shabab militants since 2006.

The Takfiri militant group was forced out of the capital by African Union troops in 2011 but still controls parts of the countryside and carries out attacks against government, military and civilian targets seemingly at will in Mogadishu and regional towns.