WASHINGTON — The United States military bombed Islamic State fighters in Somalia for the first time on Friday, a sign that the air campaign against the group was expanding after recent battlefield successes against the militants in Iraq and Syria.

Several militants were killed in a pair of strikes hours apart in the country’s northeast, according to a statement from United States Africa Command.

“U.S. forces will continue to use all authorized and appropriate measures to protect Americans and to disable terrorist threats,” the statement said, adding that the strikes were carried out in coordination with the Somali government.

The announcement of the new strikes came hours after President Trump said on Twitter that his administration had attacked the Islamic State “much harder” over the past two days. It was not immediately clear what he was referring to — the larger air campaign against the extremists in Iraq and Syria remained steady, according to the military — but the announcement of the bombings in Somalia helped clarify his statement.

The Islamic State has suffered numerous defeats in the past several months, including the loss of their stronghold in the Iraqi city of Mosul and in their de facto capital, Raqqa, Syria.

Mr. Trump gave the military wider latitude this year to go after militants in Somalia, specifically those associated with the Shabab terrorist group. The head of Africa Command, Gen. Thomas D. Waldhauser, waited months before exercising the authorities, citing the difficulty of striking militants mixed with a civilian population on the move in the midst of a regional famine.

According to an analysis by the Long War Journal, a publication that tracks militant groups in Africa, the Islamic State has a small presence in northeastern Somalia and consists of dozens of fighters led by a militant that had defected from Shabab.

Before Friday’s strikes, the American military had primarily focused on the Shabab in Somalia, carrying out 15 airstrikes against them since the start of this year, according to the Long War Journal. The Shabab were responsible for the truck bombings last month that killed more than 300 people in Somalia’s capital, Mogadishu.

In May, a Navy SEAL was killed in a raid against the group in Somalia. Several hundred American troops are in the country, primarily advising Somali forces and their African nation allies in the fight against Shabab militants.

In recent weeks, the American military’s presence across Africa has come under increased scrutiny. A team of Green Berets and support soldiers were ambushed on Oct. 4 by militants thought to be associated with the Islamic State near the Niger-Mali border. Four soldiers were killed.

In June, a Special Forces soldier, Staff Sgt. Logan J. Melgar, was found dead in his room in Bamako, Mali. It was unclear how he died, but naval authorities are investigating whether two commandos from SEAL Team 6 strangled him.