"Today we agreed on the fact that the solution of the conflict (in Libya) should not be military, it is necessary that the solution is a political one," Tunisian Foreign Minister Taieb Baccouche told reporters after meeting his Italian counterpart Paolo Gentiloni in Tunis.
"Military solutions will not solve problems. They complicate them further and lead to mass migration," Baccouche said in remarks echoed by Gentiloni.
Libya has been wracked by violence since the NATO-backed overthrow of dictator Moamer Kadhafi in 2011.
It has rival governments and parliaments and a recent spate of killings by militants who have pledged allegiance to the Islamic State (IS) group sparked calls for international military intervention.
UN envoy Bernardino Leon has clambered to get warring factions to join in direct peace talks, but the initiative has stalled.
Gentiloni said dialogue was Libya's only hope.
Signup to our newsletter and follow us on Facebook and Twitter!
"Italy is committed to support by any means the commitment of the UN envoy" and to "put the Libyan issue top of the global agenda," said Italy's top diplomat.
Last week Libyan militants released an IS-style video showing the beheading of 21 Coptic Christians, prompting hundreds of Egyptians in Libya to flee to neighbouring Tunisia.
In January, IS's Libyan branch also claimed the murder of two Tunisian journalists.
Italy fears the chaos in Libya -- from where thousands of migrants have fled to its shores this year -- could help jihadists establish a stronghold from which they could launch attacks on European soil.
Family members of Tunisians who have disappeared while trying to reach Italy by boat held a protest outside the foreign ministry on Wednesday.
Baccouche and Gentiloni said they discussed security cooperation to "face the dangers of terrorism", as well as immigration.