A series of military victories over extremist Islamic groups along Libya's Mediterranean coastline has forced hundreds of militants, including Islamic State fighters, to seek refuge in the vast deserts of the North African nation, already home to militias from neighboring countries, cross-border criminal gangs and mercenaries.
Libya's lawless, desolate center and south provides a sanctuary for militants to reorganize, recruit, train and potentially plot for a comeback. That is especially important at a time when the Islamic State group lost not only its urban holdings in Libya but is crumbling in Iraq and Syria.
In Libya's remote stretches near the borders with Egypt, Sudan, Chad, Algeria, Niger and Tunisia, multiple armed groups already operate freely. Arms are easily available. Human trafficking and cross-border smuggling, especially fuel, are rampant and lucrative.
Lack of effective border controls has allowed militiamen fighting the Sudanese and Chadian governments to set up camp inside Libya. Alongside them came soldiers-for-hire from places as far afield as Cameroon. Tribal and ethnic rivalries frequently boil over into deadly strife.
Militants travel back and forth near the southern borders and all the way to the central parts of the country, robbing travelling cars and attacking civilians, said Brig. Gen. Abdullah Nouredeen of the Libyan National Army. They sometimes work close to the borders since there is money to be made from smuggling and arms trading.
The migration of the militants comes after rivals drove them out of coastal cities like Sirte, Benghazi, Sebratha and Derna. Their dispersion into the desert undermines prospects for a return of stability in oil-rich Libya.
Claudia Gazzini, the International Crisis Group's senior Libya analyst, said IS militants were generally lying low in the desert south of the coastline, moving in small convoys so as not to attract attention or just going home. Others, she explained, were active around Sirte, staging occasional attacks against their adversaries.
Going forward, she said, IS remnants will likely try to influence and win over groups opposed to Gen. Khalifa Hifter, the Egyptian-backed commander of Libya's national army who has been fighting militants.
We are already seeing signs that this may have already happened, she said.
Sensing danger, Egypt has begun to closely monitor its borders with Sudan and Libya, fearing the area could turn into a major staging ground for attacks inside its territory. Egypt has said IS militants fighting its security forces in the Sinai Peninsula receive arms and fighters from Libya. It said militants behind recent deadly attacks against Christians were trained in Libya and sneaked into Egypt across the porous desert border.
Like the rest of Libya, the desert towns and villages in the country's central and southern regions have seen law and order vanish since the 2011 ouster and death of dictator Moammar Gadhafi. Across the country, militias - many of them with Islamist ideologies - have carved out fiefdoms, imposing their will on local administrations.
Some estimates put the number of full-time militiamen in Libya at around 120,000 and IS fighters around 1,000, but there is no way to independently verify these figures.
Gen. Hifter has sought to drive out Islamic militants and bring the center and south under his control - but with limited success. He said he intends to seal off Libya's borders with Egypt, Sudan and Chad by early July to stop the flow of arms, fighters and migrants.
It is widely believed, however, that his forces don't have the resources to enforce order in the vast region or take on the hardened militants and militiamen there.
In a sign of desperation over deteriorating security, Libya's national oil company halted shipments to the south, after a series of hijackings of convoys delivering fuel. Invariably, the fuel surfaced later in the black market or in neighboring countries.
The following are key geographical locations for the militants and armed groups:
Zamzam Valley is south of Misrata about 50 kilometers (30 miles) from the coast. Scores of IS militants found refuge there after they were defeated last year by militiamen loyal to the U.N.-backed government in Tripoli after a months-long battle. IS fighters in Zamzam Valley occasionally launch attacks against Misrata, the hometown of the militia that drove them out of Sirte, as well as kidnap travelers or attacks checkpoints.
This location in the remote southeastern corner of Libya close to the borders of Algeria and Niger has become something of a mercenaries central because of the hundreds of guns-for hire stationed there. The men, mostly from Chad, Niger and Cameroon, are hired mostly to fight under the banners of different militias. They make an average of $2,000 a month when hired. Militias and criminal groups in al-Awaynat, meanwhile, make money from human trafficking, kidnappings for ransom and smuggling of weapons, drugs and fuel.
Small cells of IS and al-Qaida fighters are believed to have moved to the outskirts of this oasis city in southeast Libya in recent months. Al-Kufra has for decades been torn by a deadly conflict pitting the Arab Alzway tribes against the sub-Saharan African Tabu group, which inhabits a large swath of territory stretching across northern Chad, southern Libya, northwestern Sudan and northeastern Niger.
Alzway dominate the city and accuse the Tabu of harboring criminals and militants from Sudan and Chad. The Tabu deny the charges. Militias from both sides are involved in tit-for-tat raids that often target civilians. The conflict is widely seen as a rivalry over control of border crossings and lucrative smuggling routes.
Two brigades from Hifter's Libyan National Army are stationed at al-Kufra, but they don't have the manpower or resources to enforce law and order in the vast desert area.
Most of the hundreds of militants who managed to flee the assault on Sirte last year are thought to have made it near this town in central Libya.
It was a perfect destination. The city is virtually out of control, with several ongoing conflicts. The main players are Awlad Suleiman, an ethnically Arab tribe, and the Tabu and Twareg, all of whom have for years been vying for a bigger slice of the smuggling trade.
Anti-government militiamen from Sudan and Chad provide a pool of mercenaries for any armed group. They are also involved in cross-border arms smuggling, according to local politician Youssef Kalourki.
IS fighters in the area keep a low profile, spending most of their time in valleys and mountains outside the city.
In May, forces loyal to Hifter seized a nearby air base and several localities. It was a significant victory, but Hifter's forces remain a long way away from controlling the region.
This town southwest of Sabha saw fierce fighting among rival criminal gangs in 2015 that displaced almost the entire population. The hostilities were triggered by an attempt by several militias to control the black market in subsidized fuel provided by the Tripoli government.
Radical militant groups in the area, including al-Qaida in the Islamic Maghreb, are known to be involved in the illicit trade, selling the fuel in neighboring countries for at least 10 times the price in Libya.
Source: Voice of America