Libya remains a violent and divided nation rife with independent militias, flooded with arms and lacking legitimate governance and political unity. Tripoli, the capital, is controlled by a patchwork of armed groups that have built local fiefs and vied for power since Libya’s 2011 uprising. Running gun battles have seized Tripoli in recent days.
“Libya is descending into chaos,” said Brig. Gen. Zakaria Ngobongue), a senior Chadian officer who directed a major counterterrorism exercise here in the Chadian capital last week involving 2,000 African and Western troops and trainers. “It’s a powder keg.”
Libya’s neighbors have rushed to ward off the threat of Islamic fighters seeking safe haven within their borders or trying to recruit their young people to fill its depleted ranks.
Tunisia, which has suffered several devastating terrorist attacks in recent years, has already built a 125-mile earthen wall, which stretches about half the length of its border with Libya, in an attempt to prevent militants from infiltrating.
Since last summer, the United States has been flying unarmed surveillance drone missions over Libya from bases in Tunisia, a significant expansion of that country’s counterterrorism cooperation with the Pentagon.
Algeria announced this month that it had opened a new air base in the country’s far south to help secure its borders with Mali, Niger and Libya.
And Chad closed its borders with Libya in January, fearing potential terrorist infiltration. The country reopened one main border crossing this month under pressure from border towns suffering a dearth of commercial traffic and to allow Chadian citizens to return home from Libya.
“As long as the Libyan chaos lasts, security in the Sahel and the Sahara will always be strained,” President Idriss Déby of Chad told a regional security conference in Bamako, Mali, this month. The Sahel is a vast area on the southern flank of the Sahara that stretches from Senegal east to Chad.
American intelligence agencies offered wide-ranging estimates last year on the peak number of Islamic State fighters in Libya — mainly in Surt, but also in Benghazi and Tripoli — with some assessments topping 5,000 militants.
Perhaps several hundred of those fighters have survived and fled in various directions within the country, or even to Europe, military officials and intelligence analysts say.
“The multiple militias and fractured relationship between factions in east and west Libya exacerbate the security situation, spilling into Tunisia and Egypt and the broader Maghreb, allowing the movement of foreign fighters, enabling the flow of migrants out of Libya to Europe and elsewhere,” General Waldhauser said.
Even before President Trump took office, vowing to intensify the global fight against ISIS, the Pentagon was accelerating its counterrorism efforts here in Central Africa.
The United States is building a $50 million drone base in Agadez, Niger. When completed next year, it will allow Reaper surveillance drones to fly from hundreds of miles closer to southern Libya, to monitor Islamic State insurgents flowing south and other extremists flowing north from the Sahel region.
American Special Operations forces and the C.I.A. have been working for more than a year to identify militia fighters in Libya who the United States can trust and support as a ground force to combat ISIS fighters, as the Pentagon did last year with militias from Misrata.
“We must carefully choose where and with whom we work with to counter ISIS-Libya in order not to shift the balance between factions and risk sparking greater conflict in Libya,” General Waldhauser said.
In the meantime, American spy agencies, as well as Western and African intelligence operatives, are monitoring the movements of ISIS fighters, who officials say have been wary of gathering in large groups since the January strike by B-52s and armed Reaper drones flying from Sicily. American commanders say they could conduct more strikes if insurgents mass in large enough groups.
“We will be able to keep pressure on that ISIS network enough to keep it decentralized so that it cannot mass and to buy time for the G.N.A. to develop governance,” said Brig. Gen. Donald C. Bolduc, who oversees American Special Operations forces in Africa, using an acronym for the new Libyan unity government.
General Bolduc acknowledged in an interview, however, “None of this is going to happen fast.” He noted that the Islamic State in Libya is “looking to work gaps and seams, and doing it all over again to gain a foothold, influencing the populace.”
It is an assessment shared by independent Libya specialists.
“ISIS in Libya is down but not out, and in the meantime, all of Libya’s other problems remain, which ensures that ISIS or something a lot like it will have little problem reasserting itself when the time is right,” said Michael R. Shurkin, a senior political scientist at RAND and a former C.I.A. analyst. “Be wary of any U.S. policy that amounts to calling it a victory and walking away.”
An earlier version of this article incorrectly described the aircraft that carried out strikes against an Islamic State training camp in January. They were B-2 bombers, not B-52 bombers.