Tunis - Libyan military strongman Khalifa Haftar visited neighbouring Tunisia on Monday for talks with President Beji Caid Essebsi, who offered to act as a mediator between rival Libyan factions.
Libya, which plunged into chaos after the ouster and killing of dictator Moammar Gaddafi in 2011, has two rival governments and parliaments, as well as several militia groups battling to control its oil wealth.
"The stability of Libya is a necessary condition for the stability of Tunisia," Essebsi said, calling on Libyans to "overcome their differences" and "to work to build a state".
In a statement, he said Tunisia did not want to "interfere in Libya's internal affairs" but rather to "facilitate dialogue between the different components of the Libyan people".
Libya's Government of National Unity, based in the capital Tripoli, is backed by the United Nations but has struggled to assert its influence across the country.
The head of a rival government, backed by Haftar's self-proclaimed Libyan National Army which controls much of the country's east and south, on Sunday urged the international community to recognise his administration.
Essebsi's office said on Monday Haftar had expressed his "gratitude to the Tunisian president for his continuing efforts to reach a settlement".
Tunisia has been impacted by lawlessness in Libya which meant jihadist organisations including the Islamic State group were able to operate.
A series of jihadist attacks have hit Tunisian tourist sites and security forces since a 2011 revolution that toppled long-time dictator Zine El Abidine Ben Ali and triggered the Arab Spring uprisings.
In 2011, several hundred thousand people fled Libya into Tunisia as the uprising against Gaddafi gained momentum.