Why did Saqr Geroushi, the commander of Operation Dignity’s Libyan air force recently announce that the forces under his command would shoot down Turkish aircraft that entered Libyan airspace without permission? Turkey’s reaction was swift. Its Ministry of Foreign Affairs condemned the threat and indirectly chastised the forces under the command of General Khalifa Haftar, who launched and continues to lead Operation Dignity, and is supported by the United Arab Emirates, Egypt and Saudi Arabia.

Haftar, in previous statements, has made it clear that he intends to rout and outlaw the Muslim Brotherhood, whose Libyan political affiliate, the Justice and Construction Party (JCP) Turkey has supported since it was first established in March 2012. After the euphoria of the Libyan revolution receded, the JCP failed to broaden its base of support and struggled to capitalize on the Brotherhood’s newfound electoral freedom. As Mary Fitzgerald, a journalist and Libya analyst, notes, Muammar al-Qaddafi’s long suppression of the Muslim Brotherhood has damaged the group’s brand and limited its electoral viability, “while the Brotherhood’s setbacks across the Middle East have further emboldened Libyan anti-Brotherhood activists.”

These Brotherhood setbacks began in Egypt in July 2013 and extended to Libya shortly thereafter. After the overthrow of former Egyptian President Mohamed Morsi, for example, certain elements within the Libyan armed forces, along with anti-Islamist militias sought to take advantage of the region’s anti-Brotherhood sentiment to suppress the movement inside Libya.

To be fair, no outside power had much hope of navigating Libya’s dizzyingly complex political landscape after the revolution. However, Ankara’s support for the Muslim Brotherhood throughout the Middle East irritated most of the Gulf States (with the exception of Qatar), and contributed to a broader opposition to the JCP in Libya. After the July 2013 coup in Egypt, Egyptian strongman General Fatah Al Sisi, working with the United Arab Emirates and other anti-Brotherhood Gulf States, began to support Operation Dignity’s alliance of individual tribesmen and militias fighting under Haftar’s command.

Turkey and Qatar, in contrast, have reported links to Islamist-allied militias, known collectively as the Libya Dawn coalition. Ankara thus became entangled in a proxy battle that has pitted it against the majority of the Gulf States. To this end, in June 2014, Haftar accused Turkey and Qatar of supporting “terror” and called on the “citizens of Turkey and Qatar [to] leave Libya within 48 hours” of his saying so. The Justice and Development Party, or AKP, President Erdoğan’s party, denies these links, arguing that it supports national reconciliation and that it is working with all parties to promote political dialogue.

Two months after Haftar’s accusations, Emirati pilots, operating out of an airbase in Egypt, struck Libyan Islamist-allied militias as they battled rivals in Tripoli. Despite the airstrikes, however, Islamist-allied militias took over Tripoli, forcing Libya’s government, then headed by Abdullah al-Thinni, to flee the capital. Al-Thinni is based in the eastern town of Baida and Libya’s internationally recognized parliament is now based in the eastern city of Tobruk. In Tripoli, the Operation Dawn Islamist-allied coalition asked a failed prime ministerial candidate, Omar al-Hassi to form and lead a new government. To date, no foreign government has recognized al-Hassi’s government, instead viewing al-Thinni as Libya’s legitimate ruler.

However, in late October 2014, Turkey’s special envoy to Libya, Emrullah Işler (who is very close to President Erdogan), met publicly with al-Hassi’s self-declared government in Tripoli; no other country has yet done so. Just two days before the meeting, Isler also announced that Turkish Airlines would resume flights to the city of Misrata, after clashes resulted in the halting of all international flights to and from the city. Misrata’s militias make up the largest component of Libya Dawn, but they reject the Islamist label. Nevertheless, these militias have allied with other Islamist groups, and have been subjected to air strikes (some of which may have been conducted by the United Arab Emirates) in support of Haftar’s forces against militias allied with Operation Dawn near Tripoli.

Turkey has also been accused of having links to Ansar Al-Sharia (ASL) – a jihadist organization based in Benghazi that has been blamed for the 2012 attack on the U.S. consulate in the city. These reported ties prompted one unnamed American official to state, “Washington believes Turkey is partnering with Qatar in providing support to Islamist factions and militias in Libya.” To be fair, the quote may have been in reference to other Islamist militias, like the February 17th Brigade, but that group has now allied itself with ASL in the Benghazi Shura council.

Ankara denies these allegations, but in January 2014, members of ASL flew to Turkey to oversee the delivery of aid to the Syrian towns of Salma and Kasab. During the assault on Kasab, numerous reports emerged suggesting that Turkey allowed a slew of rebel militias, including the al Qaeda affiliated Jabhat Al-Nusra, to transit its territory to attack the town. The town has since been recaptured by the Syrian regime. The boxes that ASL used to deliver the aid were stamped with ASL’s logo and were delivered by men openly brandishing their ASL links with logo-stamped jackets and shirts.

The decision to allow ASL into Turkey raises a number of troubling questions about the AKP’s decision-making, particularly when combined with Turkey’s support for Jabhat al-Nusra in Syria. The AKP rejects any links to these groups, but there is no denying that for five days in January 2014, ASL did operate from Turkey.

More recently, Ankara has been working to support a United Nations sponsored process to end the fighting between Libya Dignity and Dawn. Turkey’s Defense Minister, Ismet Yilmaz, expressed his support for the “elected parliament” in Tobruk, but also indirectly criticized the United Arab Emirates, Egypt, and Haftar, saying, “it is obvious that certain figures led to civilian casualties by launching air strikes in Libya, demolishing the country’s infrastructure and violating international law and human rights, are the ones who made this statement.”

On Jan. 9, Turkish Foreign Minister Mevlut Çavusoğlu, indicated that Işler would return to Libya. The Ministry has not released Isler’s schedule, apart from indicating that he will travel to the southeastern district of Kufra. While nothing has been released, there is speculation that Işler will put pressure on Misratan militias to support peace talks in Geneva. However, at the time of writing, the Geneva process has suffered a setback, after members of the General National Congress (GNC) chose not to attend.

For his part, Çavusoğlu has said, “It’s not possible to ignore the Libyan Constitutional Court’s overruling of the last general elections, nor the realities on the ground.” The statement, which refers to a June 2014 Constitutional Court decision to void the basis for the election (and which, in theory, nullifies the electoral legitimacy of the Tobruk government), suggests that Ankara will continue to lend support to the groups it favors in Libya.

In any case, Ankara’s position remains relatively straightforward. Throughout the conflict, it has shown an affinity for groups allied with Libya Dawn. Absent any significant change, this policy is certain to continue to pit Ankara against Saudi Arabia, the United Arab Emirates, Egypt, and other Arab states suspicious of the Brotherhood and political Islam.

Aaron Stein is a doctoral fellow at the Geneva Center for Security Policy and an associate fellow at the Royal United Services Institute in London.