The oil-rich North African country bordering Tunisia has rival governments and parliaments as well as a slew of armed groups vying for power in the aftermath of its 2011 uprising that toppled dictator Moamer Kadhafi.
The chaos in Libya has "serious security implications for the region", said Michael Nayebi-Oskoui, senior Middle East analyst at Stratfor, a global intelligence and advisory firm based in the US city of Texas.
Libya has witnessed "a small but steady return of fighters" from the conflict in Syria, he said.
Tunis says 3,000 of its citizens are fighting alongside jihadist groups in Syria, Iraq and Libya, and that 500 battle-hardened veterans have returned home where they pose a security threat.
On June 26, a student armed with an assault rifle mowed down 38 tourists at Tunisia's popular Port el Kantaoui beach resort, the second deadly attack on holidaymakers in three months in Tunisia.
Authorities identified the gunman as 23-year-old Tunisian student Seifeddine Rezgui and said he had received weapons training from jihadists in Libya.
He was said to have been in Libya at the same time as the two gunmen who in March attacked the National Bardo Museum in Tunis, killing 21 tourists and a policeman.
"It is confirmed that he went to Libya illegally. He was trained in Sabratha," west of Tripoli, said Tunisia's secretary of state for security, Rafik Chelli.
He said the Bardo assailants were out of Tunisia at the same time and had trained with Ansar al-Sharia, an Al-Qaeda-linked group classified as a terrorist organisation by Washington and the UN.
- Radicalisation -
Sabratha, where Tunisian authorities say Rezgui received weapons training before going on the killing spree on a beach, lies 60 kilometres (35 miles) west of Tripoli.
The coastal town is also only 100 kilometres from Ras Jdir, the main border crossing between Libya and Tunisia.
Signup to our newsletter and follow us on Facebook and Twitter!
"Sabratha is on the edge of a region that straddles the Libya-Tunisian border known as 'Jefara.' The region is characterised by a network of formerly nomadic tribes which have made a living out of trafficking and smuggling," said Philip Stack of global risk analysts Verisk Maplecroft.
"The description of Sabratha as a 'training camp' does not necessarily mean it's military in nature. There is a good chance that its main focus is centred on radicalisation," said Stack, an expert on Middle East and North African affairs.
Sabratha falls under the jurisdiction of the powerful Fajr Libya militia alliance which last year seized Tripoli, setting up a government and parliament opposed to the internationally-recognised administration.
Security officials in Tripoli say hundreds of foreign fighters, including Tunisians returning from Syria and Iraq, have entered Libya in recent months, taking advantage of the breakdown in security.
- 'New Fallujah' -
The Islamic State group, which is among jihadist organisations that have gained a foothold in Libya, claimed both the Tunisian beach massacre and the Bardo killings.
The group now controls the coastal city of Sirte, Kadhafi's hometown some 500 kilometres from Sabratha.
"This group found fertile ground in the city after striking up an alliance with pro-Kadhafi armed groups," a local Sirte official, who declined to be named, told AFP.
"It will become a new Fallujah and a breeding ground for training extremists from various countries," he said, referring to the Iraqi city which has become synonymous with unchallenged jihadist control.
On Friday, The New York Times reported that top Tunisian jihadist Seifallah Ben Hassine, an associate of late Al-Qaeda leader Osama bin Laden, was killed in an air strike in Libya in mid-June.
Ben Hassine, also known as Abu Iyadh, is believed to have coordinated a string of assassinations, including the killing of famed Afghan anti-Taliban fighter Ahmad Shah Masood in 2011.
He has likewise been linked to the 2012 attack on the US embassy in Tunis and the murders of two prominent Tunisian politicians the following year.
Tunisian analyst Slaheddin Jourchi said the chaos in Libya posed a "real danger" for his country's "strategic security".
"Despite Tunisia's security measures, there are networks that are capable of crossing the border to bring young men into camps in Libya, train them on the kinds of weapons they want them to use in their attacks, and then bring them back into Tunisia when the time is right," he said.