JUST WATCHED

What's happening in Libya?

MUST WATCH

What's happening in Libya?01:34

Story highlights

Libyan militia says ISIS supported Manchester suicide bomber

After Syria and Iraq, the group may look to Libya as new base

Even as the so-called Islamic State has lost territory and men in Libya, it has maintained an underground network of cells in some of the most populous parts of the country. That network, according to security forces in the capital Tripoli, supported the Manchester suicide bomber Salman Abedi and his younger brother Hashim.

If the Manchester attack was planned in Libya, it would appear to be the first time an ISIS network has used the country to plot an attack in Europe. ISIS has claimed responsibility for the attack but provided no conclusive evidence it had directed Abedi.

ISIS under pressure

Libyan Government of National Accord forces attack ISIS militants in Sirte, Libya.

One of the many militia operating in Libya, the Special Deterrence Force, said Hashim was arrested Tuesday night in Tripoli and had confessed that both he and his brother were members of ISIS. Salman had been in Tripoli until very recently.

The Deterrence Force said Hashim had been under surveillance for more than a month after leaving Britain on April 16. CNN could not verify the Deterrence Force's statement.

Read More

However, as ISIS' last remaining strongholds in Iraq and Syria come under growing pressure, the group may look to Libya as a base to plan and direct terror in Europe. According to German officials, the man who carried out the truck attack in Berlin last December, Anis Amri, had contact with ISIS operatives in Libya via a secure messaging app.

ISIS has long had an underground presence in Tripoli and in towns up and down Libya's Mediterranean coast. It carried out a gun and bomb attack on a Tripoli hotel in January 2015, killing ten people.

It has also recruited young men and teenagers across Libya and neighboring Tunisia, using slick videos designed to appeal to those without jobs or prospects. A teenager for example, carried out a suicide attack at the Libyan oil port of Sidra in January 2016, according to an ISIS statement at the time. Libyan media reported he had been radicalized at a mosque in the Libyan capital.

In 2015, CNN visited the southern Tunisian town of Kasserine, where unemployment is high and poverty widespread. We were told of active jihadist recruitment in local mosques. On one street, nicknamed Avenue de Jihad, locals estimated that half the young men had gone missing, many to Libya.

Since then, ISIS has suffered a string of territorial setbacks in Libya. It lost control of the town of Derna near the Egyptian border in July 2015, and was ultimately driven out of the coastal city of Sirte late last year after being pounded by hundreds of US airstrikes and a ground attack by Libyan militia.

In western Libya, a US air strike on a jihadist training camp near Sabratha killed more than 40 people in February 2016, likely including a senior ISIS figure involved in planning attacks in Tunisia.

As ISIS fighters regrouped in a mountainous area south of Sirte, another US attack killed dozens of them in January this year -- an airstrike linked to evidence gathered about the Berlin truck attacker, Anis Amri.

Then US Defense Secretary Ash Carter said the operation was aimed at ISIS' "external plotters, who were actively planning operations against our allies in Europe ... and may also have been connected with some attacks that have already occurred in Europe."

Far from vanquished

Libyan Government of National Accord forces attack ISIS militants in Sirte, Libya.

ISIS is far from vanquished in Libya. Its leadership has certainly been degraded: the last 'emir', Abdul Qasr al Najdi, was killed in the Sirte fighting, and succeeded by a Tunisian who had lived in France, according to sources in the region. But Gen. Thomas D. Waldhauser, the head of US Africa Command, told a Congressional hearing in March that "ISIS-Libya remains a regional threat."

"The instability in Libya and North Africa may be the most significant near-term threat to U.S. and allies' interests on the continent," General Waldhauser said.

In Libya as elsewhere, ISIS is transitioning from a self-declared Caliphate to a more conventional terror organization.

Aaron Zelin, a long-time observer of jihad in north Africa at the Washington Institute, says that "if the Manchester attack is definitively tied to IS cells in Libya, it would show that the group can still be a lethal actor even without holding territory there."

Zelin says that's "an important point to consider when planning for life after the fall of the group's 'capitals' in Iraq and Syria."

The continuing political chaos in Libya, where rival militia compete over territory and resources and borders are porous, make the country an attractive refuge for ISIS.