Between the rise to power of the Justice and Development Party (A.K.P.) in the early 2000s and the eruption of the Syrian crisis in 2011, Turkey’s “zero problems with neighbors” approach to foreign policy seemed commendable. Today, however, Ankara’s foreign policy is perhaps best described as “zero neighbors without problems.” In response to the Arab uprisings of 2011, Ankara’s projection of primarily soft power has evolved into the embrace of hard power—most notably in Iraq and Syria. This transformation has angered a host of Middle Eastern governments, from Egypt to Iran, and Iraq to the U.A.E.

Amid major setbacks and failed strategies in the volatile Middle East, the Turkish leadership has subsequently come to see Qatar as Ankara’s most trusted Arab ally. Indeed, it was within this geopolitical context that Ankara’s ambassador to Doha announced plans last year to establish a joint Turkish-Qatari military base in Qatar. At the heart of Turkey’s subsequent political and military agreement with Doha is a public recognition that both states face common enemies, sponsor the same non-state actors, have similar reactions to numerous regional crises, and ultimately share several long-term objectives.

Under the agreement, Turkey pledged to protect Qatar against external threats—a natural progression of the gradual strengthening of military relations between the two countries dating back to their defense industry cooperation agreement of 2007. Turkey and Qatar signed two subsequent military agreements in 2012. Under the current agreement, which also implements intelligence sharing, up to 3,000 Turkish military personnel will be based in Qatar. In return for Turkey’s commitment to the security of the tiny Gulf Arab emirate, Doha has offered to help offset the loss of Russian tourism in Turkey following its downing of the Russian jet in 2015. An estimated $3 billion worth of economic support as well as gas export guarantees are forthcoming, should Moscow decide to further punish Ankara by withholding future natural gas supplies.

Turkey’s Interests

Indeed, the announcement of the Turkish-Qatari joint military base is ripe with symbolism. Since the fall of the Ottoman Empire and the 1979 Iranian Revolution, Turkey’s Kemalist elite has long viewed the Middle East as a dangerous and complicated region beset by tribal and sectarian violence, and religious fundamentalism. Unlike the A.K.P., which has been determined to reassert Turkish influence in the MENA region, Turkey’s secular opposition has valued efforts to improve Ankara’s ties with the West, rather than within the tumultuous Arab world.

Roughly 100 years after Ottoman troops left their last garrison in the Persian Gulf, fleeing to Iran following violent confrontations with the British, the return of Turkey’s military to Qatar fits with perceptions of ‘neo-Ottoman’ ambitions on the part of Turkish President Recep Tayyip Erdogan. Whether or not there is evidence of Turkey actually seeking to restore Ottoman glories, it is clear that Ankara is interested in projecting Turkish influence in lands once ruled by the Ottomans, including on the southern shores of the Gulf. That there is a lucrative arms market there as well doesn’t hurt.

The reassertion of Russian influence throughout the region, most importantly in Syria, certainly fuels this ambition as Turkish-Russian relations grow more tense. Although prior to 2011 there was much talk about Turkey and Russia deepening energy ties, Ankara and Moscow’s opposing stakes in Syria’s civil war have pitted the two countries against one another.

Similarly, Turkey’s relationship with Iran has also suffered as Ankara and Tehran find themselves on opposite sides of the Syria conflict. Although one of the A.K.P.’s foreign policy initiatives in the mid/late 2000s entailed improving Turkey’s ties with the Islamic Republic within the framework of “zero problems with neighbors,” the war in Syria has strained relations, although economic ties remain strong.

Continued Russian and Iranian support for the Syrian regime has resulted in major setbacks for Turkey’s policy in Syria, which has sought to oust President Bashar al-Assad and replace him with a Turkish-friendly Sunni Islamist government. In turn, Turkey has found greater common cause with the Gulf Arab states sponsoring the same actors in the Syrian conflict, and with Qatar most of all as the two countries share a similar preference for Sunni Islamist movements. The insertion of Russia into the Syrian conflict, and as a major player in the Middle East, complicates Turkey’s own designs for expanding its influence in the region. Deepening cooperation between Moscow and Tehran, which is also expanding its footprint in the Arab world, has added greater impetus for Turkey to pursue a local alliance as a counter, particularly given the lack of interest from the United States in taking a lead role in the changing regional security order. Qatar serves as the obvious first target, given it is the state most closely aligned to the A.K.P.’s regional vision.

Domestic politics enter the equation as well. Erdogan’s stifling of protest and the press, as well as the ongoing corruption scandals, has increased friction between the A.K.P. and many segments of Turkish society, as well as with Erdogan’s opposition. By expanding the country’s military footprint abroad, the joint-military base in Qatar fits neatly into Erdogan’s strategy of playing the nationalist card on the international stage, thereby diverting attention from domestic concerns. Erdogan is not the first leader in history to do so, but his penchant for authoritarian-type rule has never been manifested as strongly as it has today. His actions raise questions among not only his detractors in Turkey, but also many in the international community, about how his political ambitions may define Ankara’s foreign policy going forward.

Qatar’s Interests

Although eminently wealthy and mineral-rich, Qatar is one of the smallest states in the Middle East, surrounded by much larger powers. To protect Qatar’s sovereignty and security, officials in Doha have historically depended upon foreign support for defense. As a key U.S. military ally, the host of USCENTCOM, and a member of the Gulf Cooperation Council (G.C.C.), Qatar relies largely on its ties with Washington and Riyadh for domestic security. Doha’s strategy for international security, however, hinges on embracing a host of states as defense partners, pitting their competing geopolitical interests against one another, and advancing Qatar’s national interests in the process.

Despite being a G.C.C. member, Qatar has long considered Saudi Arabia an overbearing neighbor that does not always respect the tiny Gulf Arab state’s sovereignty and independence. They have had their differences in the past, and building relations with Turkey is one way for Qatar to keep some of its options open and maintain some room to maneuver beneath the dominant Saudi position. The establishment of the joint Turkish-Qatari military base is not intended to be a substitution for USCENTCOM, rather it factors into Doha’s strategy of diversifying the emirate’s web of defense partners, while providing more influential countries around the world with higher stakes in a stable and prosperous Qatar.

The Gulf’s Security Landscape

For many years Qatar’s foreign policy has operated outside the G.C.C.’s de facto policy framework. Doha’s relatively independent approach to foreign affairs has often irked officials in Riyadh and Abu Dhabi, who have accused the Qataris of undermining the G.C.C.’s collective security. Qatar’s support for the Muslim Brotherhood has been a major source of tension between Doha and other Gulf Arab states. In the eyes of many Arab regimes, Qatar’s state-owned Al Jazeera is merely a mouthpiece for the Muslim Brotherhood.

In March 2014, this tension sparked a diplomatic crisis in which Bahrain, Saudi Arabia and the U.A.E. withdrew their ambassadors from Doha in an effort to punish Qatar for backing the Muslim Brotherhood. Although by November the Bahraini, Saudi and Emirati ambassadors had returned to Qatar, the new emir of Qatar, who ascended to the throne in 2013, understood that his father’s foreign policy strategies had proved costly for Doha. Emir Tamim has done an impressive job repairing Doha’s relations with the other G.C.C. states. However, Qatar’s support for Islamist factions across the Middle East and North Africa continues to be a source of tension in Qatar’s relationship with other G.C.C. members—especially the U.A.E.—and Egypt. By deepening ties with Turkey, which has a foreign policy agenda closely aligned with Qatar, Doha is attempting to secure greater leverage vis-à-vis its Gulf Arab neighbors by growing its military partnership with a non-G.C.C. state.

What are Saudi Arabia’s stakes in this Turkish-Qatari military base? On one hand, there have been tensions between Riyadh and Ankara over the latter’s support for the Muslim Brotherhood, particularly against President Abdel Fattah el-Sisi in Egypt. Some in the region feared that the A.K.P. was hoping to ride a wave of Muslim Brotherhood victories in post-Arab Spring countries to a position of dominance in the Arab region. In this light, the close Qatari-Turkish relationship might worry Saudi Arabia.

On the other hand, it is important to take stock of the diminishing tension between Saudi Arabia and Turkey since King Salman ascended to the throne in early 2015. In viewing the Muslim Brotherhood as less of a threat than King Abdullah did, and in eyeing greater potential for cooperation with Ankara vis-à-vis the Syrian crisis, the kingdom may ultimately consider the Turkish military presence in Qatar as somewhat in line with Riyadh’s interests—at least for now. Indeed, Riyadh, Doha and Ankara share several common goals in the region, not only in Syria, but also in Yemen, where the three governments support the restoration of the internationally recognized government of Mansour Hadi.

The elephant in the room is, of course, Iran. Last December, Saudi Deputy Crown Prince Mohammed bin Salman stunned the world with his announcement of the creation of the 34-member Islamic Military Alliance (I.M.A.). The notable absence of Iran and Iraq from the I.M.A. underscored the pan-Sunni agenda driving it. Given that Turkey and Qatar are two of the members of this pan-Sunni military alliance, perhaps Riyadh will ultimately embrace the joint military base in Qatar, as well as a stronger Turkish military role in the Persian Gulf’s security scene. And given Riyadh’s own cold war with Tehran, the Al Saud rulers may be more accepting of the joint military base, to the extent that Ankara and Doha remain allied with the fundamental tenets of its own foreign policy, particularly related to Syria and Yemen.

Two other members of the I.M.A. may take issue, however, with Turkey’s military presence in Qatar. Egypt and the U.A.E. have had major problems with both Ankara and Doha for their support of the Muslim Brotherhood across the MENA region. Erdogan’s fierce criticism of Egypt’s military for overthrowing Mohammed Morsi in July 2013 prompted Egypt to downgrade ties with Turkey. The recently announced death sentences handed to six journalists—including two from Al Jazeera allegedly guilty of leaking state secrets to Qatar—underscores the distrust between Cairo and Doha. At that time, Egyptian officials accused Al Jazeera of backing the uprising as a Qatari “vendetta” against former Egyptian President Hosni Mubarak.

In recent years, Turkey and the U.A.E. have been opposing stakeholders in Egypt and Libya. That said, last month Abu Dhabi appointed a new ambassador to Ankara, three years after the U.A.E. withdrew its envoy to Turkey in response to Ankara’s condemnation of the 2013 forced removal of president Morsi in Cairo. This move suggests a potential interest on the U.A.E.’s part in reaching a rapprochement with the Turkish leadership.

Filling in the Void

As Qatar embraces Turkey as a defense partner during a time of growing regional turmoil, officials in Doha are following the moves of other G.C.C. states, which have turned to new partners for defense purposes. G.C.C. officials are responding to what they perceive as America’s reduced interest and influence in the MENA region, prompting a realignment of the regional order. Moreover, the Gulf Arab states share concerns about the possible decline of the G.C.C.’s relative perceived strategic value to America as a consequence of the thaw in relations between the United States and Iran. Washington's retreat from its previous role as regional hegemon has created space, albeit unwanted by many of its allies, for a new security architecture in the Middle East. The I.M.A., as well as Saudi-led military endeavors, are part of the attempt to redefine the region’s security architecture. The new Turkish-Qatari military alliance can also be seen in the same light, but the question remains whether this will operate as a standalone axis in the region, or fall under the purview of the grand Sunni alliance envisioned by Riyadh.

Although Gulf Arab rulers are determined to maintain their alliance with the United States, the G.C.C. states are pursuing their own defense arrangements to guarantee their security for the years to come. The G.C.C. has already deepened its defense ties with France, Germany, Italy, Russia and the U.K, and Turkey has seized a strategic opportunity to enter the Gulf’s evolving security landscape. How the other five G.C.C. states react to the return of Turkish forces to the Gulf a century after the British defeated the Ottomans remains to be seen. Regardless, there is every reason to expect Turkey and Qatar to deepen their strategic alliance in the future amid the region’s tumultuous geopolitical ferment.