The Friday strike, on a seaside town 50 miles west of Tripoli, targeted Noureddine Chouchane, a Tunisian militant. He had also helped arrange the arrival of Islamic State recruits into Libya, the Pentagon said in a statement confirming the strikes. Mr. Chouchane, 35, was probably killed in the attack on the compound, where up to 60 militants had been actively training for a terrorist operation, the Pentagon said.

Mr. Chouchane was accused of helping to organize an attack on the National Bardo Museum in Tunis that killed 22 people in March and another in June that killed 38 people at a beachfront resort in Sousse. He is also believed to have helped funnel as many as 1,500 Islamic State fighters to Iraq and Syria.

The Islamic State has continued to push across Libya, underscoring what diplomats say is the importance of settling the multifaceted civil war that has given it space to expand.

Libya’s political leaders are currently divided between two loose political alliances centered on rival Parliaments in the capital, Tripoli, and the eastern city of Tobruk. But the United Nations effort to form a unity government, led by the German diplomat Martin Kobler, has been stymied by the factional differences — based on town, tribe, personality or religious persuasion — that helped set off Libya’s civil war in 2014 and have persistently dogged efforts to resolve it ever since.

An agreement to form a unity government, signed in December, has been loudly opposed by the faction that controls Tripoli, which has refused to allow Mr. Kobler’s plane to even land in the capital since early January. There are tensions over any future role for Gen. Khalifa Hifter, a commander who dominates in the east.

For now at least, the United States seems set on continuing to attack targets of opportunity in Libya while supporting the troubled process led by the United Nations. “We will continue to take actions where we’ve got a clear operation and a clear target in mind,” President Obama told reporters on Tuesday. “At the same time, we’re working diligently with the United Nations to try to get a government in place in Libya. And that’s been a problem.”