A few weeks after the Saudi-led diplomatic blitz targeting Qatar, there is no doubt that Ankara stands firmly with Doha. Under President Recep Tayyip Erdoğan, Turkey has developed a close albeit asymmetrical partnership with Qatar. The two states are the region’s staunchest supporters of the Muslim Brotherhood and Hamas, and have been rather willing to flirt with Tehran. Bilateral ties, based on such ideological affinity, are strengthened by military and financial partnerships vital for Erdoğan. But make no mistake, this was no easy decision for Erdoğan.

Turkey’s initial reaction to the crisis was caution and silence, signaling more predicament in Ankara than resolve. Turkish officials’ early statements were balanced and prudent. A deputy prime minister announced Erdoğan’s active efforts to help resolve the crisis through “phone diplomacy.” The president’s spokesman stated that the Gulf countries should not base their relations on “false news and rumors,” and resolve the conflict “in line with the spirit of the holy month of Ramadan.” A Turkish journalist argued that Erdoğan was torn between the Saudis and Qataris. Another joked that pro-government columnists had each prepared two op-eds—one pro-Qatar and the other pro-Saudi—and were waiting for Erdoğan’s cue to decide which to publish.

Erdoğan’s hesitation is understandable. The Turkish president knows well that siding with Qatar, alongside Iran, would estrange him from the region’s Sunni camp, led by Saudi Arabia. Ankara has long been in a downward spiral of isolation due to its reckless foreign policy, and has been trying to reverse what it used to cherish as “precious loneliness.” Indeed, Turkey’s volatile economy has suffered from that very loneliness, and generous inflows from Qatar are not sufficient to keep Ankara afloat.

There is, of course, the Trump factor as well. After ruining his relationship with Barack Obama, Erdoğan has been keen to open a new chapter with the new U.S. administration. He refrained from confronting Donald Trump on even the most sensitive policy disagreements between Turkey and the United States, including the arming of Syrian Kurds, which Ankara considers its top security threat. For a short-fused strongman like Erdoğan, this is no small feat. Crossing Trump to side with Doha would risk spoiling Ankara’s new game plan for Washington.

Still, after twenty-four hours of hesitation, Ankara reverted to its default position and re-embraced Doha. As the Saudi camp intensified its efforts to physically isolate Qatar by closing borders and canceling flights, Turkey—together with Iran—offered to provide the increasingly isolated Gulf state with food and water supplies. Most significantly, Ankara fast-tracked a parliamentary vote for its long-standing plan to deploy Turkish troops to Qatar as part of a 2015 bilateral security agreement that foresaw the establishment of a Turkish military base within the strategically positioned Gulf state—the first Turkish military base abroad.

The move may not have been immediate, but it was consistent with Ankara’s outreach to Doha over the last decade, especially since the 2011 Arab Spring uprisings, which appeared to fuel the regional popularity of the Muslim Brotherhood. As Turkey and Qatar cast their lot with Islamists and began to fund Brotherhood chapters in Egypt, Tunisia, Libya and even Syria, the Saudi-led and acutely anti-Brotherhood Sunni bloc launched a global effort to marginalize the Brotherhood—including its Palestinian branch, Hamas. Since then, Ankara and Doha have emerged as the Brotherhood’s top patrons, both politically and financially, drawing the ire of Egypt and their Gulf friends. And while growing Iranian regional influence is believed to have precipitated the military-base agreement, both countries, in stark contrast to other actors, have maintained dialogue with Tehran. As Arab states doubled down on their anti-Iran and anti-Brotherhood policies, so did Turkey and Qatar double down on their own partnership.

Qatar’s liquefied natural gas and other riches don’t hurt the prospects of cooperation. Turkey is dependent on foreign energy and investment for its industry and economy, and in a neighborhood of overnight transformations, Doha has proved a foul-weather friend to Ankara. When Turkey entered a crisis with Russia over the Syrian conflict in November 2015, for example, Qatar offered its LNG shipments to help mitigate a potential energy cutoff from Moscow.

Although Qatari inflows represent less than 1 percent of Turkey’s cumulative foreign direct investment, Doha’s strategic targeting of the finance, media and defense sectors make it all the more indispensable as a partner for Erdoğan. Qatari investors acquired two private Turkish lenders with a combined worth of over $3.6 billion. Furthermore, as a country with a high current-account deficit, Turkey sees Qatari injections of foreign currency as a lifeline for its balance of payments. A significant portion of the $40 billion reflected in the Turkish Central Bank’s “net error and deficit” figures is believed to have come from Qatar, in a pro-government Turkish expert’s view, “because of [the Qataris’] confidence in Erdogan.”

Doha entered Turkey’s media sector in 2008 when an obscure Qatari company acquired Turkey’s second-largest media group in a controversial $1.1 billion deal—in partnership with a Turkish holding company where Erdoğan’s son-in-law was the CEO between 2007 and 2013. In another controversial deal in 2015, Qatar’s BeIN Group acquired Turkey’s largest satellite television provider from the Erdoğan-controlled Savings Deposit Insurance Fund. The $1.4 billion deal, which bypassed enthusiastic domestic buyers, took place a day after the Qatari emir’s meeting with Erdoğan.

That same year, Qatar’s Armed Forces Industry Committee acquired 49 percent of a Turkish military-vehicle manufacturer owned by an Erdoğan crony—who now serves on the ruling party’s executive committee—and appointed a Qatari military attaché to the board, drawing criticism for having an Ankara-based foreign diplomat partaking of Turkey’s public tenders.

Qatar is also a lifeline for Turkish contractors, who have undertaken projects worth $13.7 billion, making the Gulf emirate the seventh most popular destination for them.

For all these reasons, Turkey chose Qatar in the recent Gulf crisis. Indeed, it would have had little choice to discard such a lucrative partnership at a time of brewing economic crisis at home. But as the intra-Gulf row deepens, the Turkish-Qatari partnership will likely force Ankara to recalibrate its already uneasy relationship with the Saudi-led Sunni bloc. Turkey stands to become further isolated in the region and grow increasingly dependent on Doha for political and financial support. Ankara’s international image is poised only to be further tainted by this move. Erdoğan, aware of all the drawbacks, had already cornered himself into this choice.

Aykan Erdemir is a former member of the Turkish parliament and a senior fellow at the Foundation for Defense of Democracies, where Merve Tahiroglu is a research associate focusing on Turkey.

Image: Turkish President Tayyip Erdogan addresses members of parliament from his ruling AK Party (AKP) during a meeting at the Turkish parliament in Ankara, Turkey, June 13, 2017. Kayhan Ozer/Presidential Palace/Handout