CAIRO (Reuters) - France’s foreign minister said on Thursday he had firmed up security ties with Egypt, which was the “central element” to ensuring regional stability as the two countries seek to break the political impasse in neighboring Libya.

French Foreign Minister Jean-Yves Le Drian shakes hands with Egyptian Foreign Minister Sameh Shoukry (R) after their joint news conference in Cairo, Egypt June 8, 2017. REUTERS/Amr Abdallah Dalsh

Paris and Cairo have nurtured closer economic and military ties in recent years and with the rise to power of President Abdel Fattah al-Sisi that relationship has improved with both sides concerned by the ongoing political vacuum in Libya and the rise of jihadist groups in Egypt.

Speaking after a day of meetings in Cairo, including with Sisi, Jean-Yves Le Drian, who in his previous role as defense minister had developed a personal relationship with Sisi, said the two allies had a “common vision” on how to tackle Islamist militants.

“We had meetings on fighting terrorism and the stabilization of Libya,” Le Drian said during a meeting with Pope Tawadros II, head of the Egyptian Coptic Orthodox Church.

An attack at the end of May on the Coptic community in the southern city of Menya by Islamist militants killed 29 people.

“Egypt is the central element for regional stability and when it sways the whole region sways,” Le Drian said.

Le Drian’s visit was the second by a French minister this week. Defence Minister Sylvie Goulard held talks with her Egyptian counterpart on Monday on how to reinforce security cooperation including the best way to enhance monitoring of Egypt’s borders.

Diplomats have said that Paris is reviewing its position on the Libyan conflict, with new President Emmanuel Macron deciding to push the issue to the top of his foreign policy agenda.

“Libya is a priority for France,” a French diplomat said.

Libya is split between a U.N.-backed government in Tripoli, which is loosely supported by militias in the west that includes Islamist groups backed by Turkey and Qatar, and eastern military commander Khalifa Haftar, which the United Arab Emirates and Egypt support.

The UAE sees Egypt’s leadership as a firewall against militants and has given Cairo financial and military support, Western and Arab diplomats say.

“We cannot let the situation of instability that is benefiting terrorists and traffickers continue on Egypt’s borders and at the gates of Europe continue,” Le Drian told reporters.

Some Western states, including France, have also given Haftar military support to help fight Islamists in Libya’s east, but diplomats say that he will ultimately have to sit down and negotiate with the U.N.-backed government of Fayez al-Seraj and militias in the west.

French officials said there was now a growing convergence of views with Egypt and the UAE to push all sides back to the negotiating table, which would see a round of shuttle diplomacy in the coming weeks to form a consensus among the outside players to first push Haftar and Seraj together.

The diplomatic row between Qatar and major Arab states including Saudi Arabia and Egypt may also provide an opportunity to pressure western militias, officials said.

(This version of the story was corrected to show attack on Coptic Christians was in Menya in paragraph 5)