BENGHAZI, Libya — Libya is rapidly turning into a new front in the fight against the Islamic State, which is heavily recruiting militants from abroad and trying to exploit years of chaos to expand its foothold in the oil-rich North African nation.

Washington and its European allies are seeking to end the interminable divisions among Libyan factions to form a unity government that the West can support in fighting the jihadis. U.S. airstrikes Friday against an Islamic State training camp, which killed more than 40 suspected militants including a prominent Tunisian leader, were a sign the U.S. is ready to move robustly even before a unity government is agreed upon.

From their stronghold in the city of Sirte, the militants have lashed out in recent months with suicide bombings against police. They have made forays attacking Libya’s vital oilfields and export facilities, setting back efforts to rebuild its only money-making industry.

The Islamic State, also known as ISIS or ISIL, has so far been unable to take over large parts of Libya as it did in Syria and Iraq – and the Libyan branch has suffered some setbacks in the past year. Rival militias drove its fighters out of one city, Darna, and a U.S. airstrike in December killed the leader of the affiliate.

But it has recently launched a drive to build up its presence: U.S. officials say in past weeks and months, the Islamic State has been bringing in fighters from abroad, mainly from North Africa and sub-Saharan Africa. From around 3,000 fighters, they estimate it now has a total of about 5,000.

Forging a unified Libyan government to fight the jihadis is a monumental task in what has effectively been a failed state since the 2011 ouster and death of dictator Moammar Gadhafi.