TRIPOLI (Reuters) - France’s Foreign Minister Jean Yves Le Drian was in Libya on Monday to meet rival political leaders and offer support for a deal aimed at stabilizing the strifetorn North African country.

French Foreign Affairs Minister Jean-Yves Le Drian (L) speaks during a news conference at the headquarters of the prime minister's office in Tripoli, Libya September 4, 2017 . REUTERS/Ismail Zitouny.

Libyan Prime Minister Fayez al-Seraj and the divided nation’s eastern commander Khalifa Haftar signed an agreement in Paris in July committing them to a conditional ceasefire and to work toward elections in 2018. The deal did not include other key factions.

Western governments, worried about Islamist militants and smugglers thriving in Libya’s chaos, are pushing a broader U.N.-backed deal to unify Libya and end the instability that has weakened the country since the 2011 fall of Muammar Gaddafi.

In Tripoli, Le Drian met Seraj and planned to hold talks with Abdulrahman Swehli, a politician connected to some of Haftar’s rivals who heads a parliamentary council in the capital, Libyan officials said.

Le Drian was also to visit Misrata, Swehli’s home city and a base of opposition to Haftar, before heading to Benghazi to meet Haftar and to Tobruk to meet the head of an eastern-based parliament aligned with him.

“The minister wants to consolidate this agreement by getting the parties not invited in July to support it,” said a French diplomatic source.

“He wants to ensure that everyone is playing the game and lay the groundwork for elections.”

The French minister’s visit is in line with President Emmanuel Macron’s push for a deeper French role in bringing Libyan factions together in the hope of countering militant violence and easing Europe’s migrant crisis.

“FRAGILE BALANCE”

“Our objective is the stabilization of Libya in the interests of the Libyans themselves,” Le Drian said in a statement in Tripoli.

“A united Libya, equipped with functioning institutions, is the condition for avoiding the terrorist threat in the long term.”

He said the Paris deal was meant to support the U.N.-backed accord for a government of national unity. Le Drian met U.N. special envoy Ghassan Salame on Sunday.

The French diplomatic source said the visit would fit into efforts by Salame to announce a road map to elections during the coming U.N. General Assembly.

“Seraj and Haftar clearly want to measure themselves in elections,” the source said.

Libya would likely need to agree on a new constitution or electoral law before elections, which will be a difficult task for the country’s divided institutions. Organizing polls would also involve big logistical and security challenges.

Past Western attempts to broker agreements have often fallen victim to political infighting among rival factions and armed brigades vying for power in the OPEC oil producer.

Seraj’s government has struggled to impose control and its presidential council is divided. Haftar has refused to accept its legitimacy. He has been gaining ground, backed by allies Egypt and United Arab Emirates.

“The ceasefire between non-terrorist elements is in general respected,” the French diplomatic source said.

“Haftar’s advances are accompanied by a strengthening of Seraj in the west so it’s creating a fragile balance that encourages a compromise.”