Eastern Libyan military commander Khalifa Haftar arrived in Ankara on Tuesday for his first known visit to Turkiye, accompanied by his sons Khaled and Belqasim. The visit came two days after a Ukrainian long-range attack struck a Russian warship in Benghazi, killing at least 10 Libyan and Russian crew members, according to local authorities.

Photos released by the General Command of the Libyan National Army (LNA) showed Turkish Chief of General Staff General Selcuk Bayraktaroglu greeting Haftar at the airport. There was no official media readout of the meeting, but Reuters news agency reported that Haftar is set to meet Turkish President Recep Tayyip Erdogan.

Khaled Haftar is the LNA’s chief of staff, while Belqasim heads Libya’s Development and Reconstruction Fund. Saddam Haftar, the LNA’s deputy commander and heir apparent, was in Doha for a separate meeting with Qatar’s minister of state for defence.

The Russian warship had docked in Benghazi, the main city in Haftar-controlled eastern Libya, to refuel and resupply under an agreement with the eastern authorities. Libya’s internationally recognised government in Tripoli condemned the attack on Monday, saying neither Russia nor Ukraine had the right to conduct military operations on Libyan territory or in its waters.

Turkish military support for Tripoli predates the Ukrainian attack: Ankara helped the then-Tripoli government repel Haftar’s forces’ offensive in 2019 and 2020. Since a United Nations-brokered ceasefire ended major fighting in 2020, Turkiye has built ties with Haftar’s camp while maintaining its alliance with Tripoli.

On Saturday, Turkish Foreign Minister Hakan Fidan and intelligence chief Ibrahim Kalin met Abdul Hamid Dbeibah, prime minister of Libya’s Tripoli-based Government of National Unity, in Istanbul. Fidan later told a Turkish television station that Erdogan will visit Libya in December after a 15-year hiatus.

Haftar’s Ankara visit follows a decision by Libya’s eastern-based House of Representatives, taken weeks earlier, to approve a 2019 maritime deal with Turkiye. The move reversed years of opposition and was largely seen as an overture towards Turkiye as power-sharing talks in the country stall.

Haftar’s son Saddam is reportedly seeking the Libyan presidency, with backing from Washington. The US is trying to broker a power-sharing proposal between Tripoli and Benghazi that would make Saddam chairman of the Tripoli-based Presidency Council (PC). The effort is championed by Massad Boulos, United States President Donald Trump’s senior adviser for Arab and African affairs.

Powerful factions in Tripoli and the western city of Misrata oppose giving Saddam the post, Libya analyst Jalel Harchaoui told Al Jazeera. “The Turks are more pragmatic and realistic than Boulos,” Harchaoui said. Ankara takes that opposition seriously, he said, because trying to force the appointment could destabilise Libya.

Harchaoui said approving the 2019 memorandum of understanding between Turkiye and Libya’s UN-recognised former Government of National Accord (GNA), on delimiting maritime boundaries in the Mediterranean Sea, was an effort by Saddam Haftar to secure Ankara’s backing for the council chairmanship. The European Union, Greece, Israel and Egypt condemned the vote.

Although Saddam Haftar was not at the Ankara meeting, Harchaoui said Erdogan had given himself another way to show progress in bringing Libya’s rivals together by inviting his father. As Erdogan prepares to visit Libya, the Turkish president may seek a meeting between Dbeibah and Khalifa Haftar. Ankara is seeking to carve “a format of its own, calibrated to its own risk appetite and independent of the one Boulos has been pushing for months”, according to the analyst.