Smoke rises during heavy clashes between rival factions in Tripoli, Libya, May 27, 2017. REUTERS/Hani Amara

ALGIERS (Reuters) - Libya’s neighbors Algeria, Egypt and Tunisia agreed on Tuesday to push for political dialogue to end the crisis in the North African country and rejected foreign interference or any military solution.

The “Algiers declaration” came after Egyptian jets last month carried out repeated air strikes targeting camps for Islamist militants inside Libya who Cairo says were responsible for an attack on Egyptian Christians.

The joint statement appeared to be an effort to smooth over differences among the North African neighbors over how to bring stability to Libya, where rival armed and political factions have been fighting since the fall of Muammar Gaddafi in 2011.

A U.N.-backed government installed in Tripoli is trying to expand its influence and work with Western powers on security and immigration. But it has been rejected by some armed factions inside Tripoli and powerful rivals to the east backed by military commander Khalifa Hafter.

Algeria has been pushing for an inclusive dialogue in Libya, while Egypt has more openly voiced support for Haftar, who has launched campaigns against Islamist militants and has so far rejected a U.N.-backed government in Tripoli.

The ministers focused on the “preservation of territorial integrity, sovereignty and unity of Libya”, they said at the end of their closed-door meeting.

“The political solution is the only way to resolve the crisis through inclusive dialogue, the rejection of interference and military options,” said the statement on Algeria’s state news agency APS.

Egypt sees any militant activity in eastern Libya, which is near its border, as a threat to its own national security. One of the reasons Egypt’s leadership has supported Haftar since 2014 is to try to ensure all Islamists are driven from eastern Libya.