Southern Libya is rapidly becoming an ungoverned space, home to extremist groups and international smugglers, as a weak government struggles to assert control and overlapping security structures jostle violently for dominance.
Libya's porous borders worry its neighbours with extremists and smugglers on rise
Regional politicians, diplomats and analysts have raised concerns in recent months after a series of attacks inside and outside the country pointed to an increased presence of armed Islamist groups, some closely linked with Al Qaeda in the Islamic Maghreb.
Repeated efforts by the Libyan government, which has struggled to maintain security even in the urban areas where it has most influence, to strengthen its southern borders seem to have failed. There are growing fears that, without intervention, attacks on industrial and state targets in Libya and its neighbours could become more frequent.
Libya "continues to be a source of destabilisation for the countries of the Sahel", said Mahamdou Issoufou, the president of Niger, last month, after he said militants came from Libya and detonated two bombs at a uranium factory in the northern city of Agadez, one at a uranium mine in Arlit and another in an army base in the northern city of Agadez, killing at least 21 people.
Two militant groups - the Movement for Oneness and Jihad in West Africa and the Signed-in-Blood battalion headed by one-time Al Qaeda leader Mokhtar Belmokhtar - said they worked together to stage the attacks.
The attack was similar in some ways to the one on the In Amenas oil and gas installation in eastern Algeria, which was also claimed by Belmokhtar and was carried out by men who came from Libya.
"The Libyan government's already weak authority is significantly diluted in the Sahara," said Geoffrey Howard, of the Control Risks consultancy group, referring to the sparsely populated desert that stretches across Libya and a swath of other North African countries. "It certainly doesn't have any control over its borders."
Before the internationally backed uprising in 2011 that felled Muammar Qaddafi after 42 years of rule, Libya's south was more stable. This, said Claudia Gazzini of the International Crisis Group think tank, was not because there was rigorous border control or rule of law, but because the tribal hierarchies and smuggling networks were well-established.
Tribes favoured by Qaddafi - the Warfalla and the Qaddafa - were given money and support from the government, while smuggling networks operated "more or less with government knowledge".
Particularly when the country was under international sanctions in the 1990s, said Ms Gazzini, life would have been even more difficult without the informal routes into the country for food, arms and goods such as televisions, which move freely through the trans-border areas on the northern and southern edge of the Sahara known as the Sahel.
The regional order was dramatically destabilised with the fall, and death, of Qaddafi. The tribes that he favoured are now tainted by association with him, and a struggle for power among other tribes is continuing and occasionally violent.
The monopoly that established smuggling groups enjoyed is now subject to competition. According to Noman Benotman, a Libya expert with the Quilliam Foundation in London, there has been a dramatic rise in the smuggling of drugs, particularly cocaine from South America, and arms stolen from Qaddafi-era weapon depots.
The unrest also has an ethnic element, with dark-skinned ethnic Toubous, who often came to Libya from neighbouring, impoverished Chad and Niger in exchange for citizenship, money and sometimes work as fighters, now condemned as Qaddafi mercenaries and jailed or attacked.
Into this unsettled space, radical groups have been able to insinuate themselves. A letter to Belmokhtar from Abdulmalek Droukdel, the head of Al Qaeda in the Islamic Maghreb, published recently by the Associated Press, referred approvingly to "taking advantage of the events in Libya".
Two teams, the letter said, were formed and are still operating in Libya.
The letter is likely to have been written last year. Since then, under pressure from the French-led intervention in Mali which began in January, most of the militant groups, who took over the north of that country last year, have fled. Some have ended up in Libya.
"There is evidence that Libyan leaders believe that there are some jihadi groups that came back from other parts of north Africa and created bases around the Sahel," said Ms Gazzini. "You have groups from the religious and political spectrum competing for power in southern Libya - and a latent rivalry between the army and police and parallel security forces."
There is also anecdotal evidence to suggest that Al Qaeda and other groups are trying to gain control of smuggling networks and to build links with tribes who are emerging as powerful, said Mr Howard from Control Risks.
If true, this would be a similar to the groups' operations over the past decades in Algeria, Mali and Mauritania, where fighters often make tribal alliances through marriage and some of the huge drug, arms and cigarette-smuggling industries are controlled by Islamist militants.
International alarm at the situation has been growing. Tunisian and Algerian leaders, whose countries border Libya and who say their security has been threatened by the heavy weapons and fighters that move freely there, have held security meetings with Libyan officials.
But privately, Algerian officials complain that the Libyan government is so fluid that the responsibilities change too frequently to have an effect.
A conference in Paris in February brought together officials from western and Arab countries, including the UAE and Qatar, to discuss Libyan security. The Libyan foreign minister Mohamed Abdulaziz called for a "united front against terrorism", as he hosted the conference alongside the French foreign minister Laurent Fabius. Since then, in April, a car bomb hit the French Embassy in Tripoli, causing considerable damage, and Mr Fabius has called for African countries to work with Libya on security.
"It seems we must make a special effort on southern Libya - which is also what Libya wants," he told reporters after meeting President Issoufou in Niger last month. "We spoke about the initiatives which neighbouring countries can take in liaison with Libya."
The Libyan prime minister, Ali Zeidan, has responded angrily to allegations by neighbouring countries that its lack of security is creating a regional problem. Analysts point out that militant and smuggling groups are widely dispersed throughout neighbouring countries as well as Libya.
"Have Al Qaeda in the Islamic Maghreb and other groups gone to Libya?" said Mr Benotman from the Quilliam Foundation. "Yes, but not just - they are in southern Libya, southern Algeria and Darfur ... In Libya you find Al Qaeda and in northern Niger you find different groups. It's not just one issue."