Iraqi Prime Minister Haider al-Abadi has expressed outrage at the recent Turkish parliamentary extension of the mandate of Turkey’s military presence on Iraqi soil. For months, Turkish forces have maintained a contingent in northern Iraq, ostensibly at the invitation of local forces, with the announced mission of training them in preparation for the battle for Mosul. With multiple parties preparing for the offensive, Mosul, Iraq’s second largest city, is slated to be liberated from a 30-month-old Islamic State (ISIS) occupation. Denouncing the Turkish presence as “occupation” and an offense against Iraqi sovereignty, Abadi has demanded an immediate and full withdrawal, threatening to proceed otherwise with a full-throttle diplomatic escalation. Turkey, Abadi insisted, will not be part of the anticipated Mosul offensive. As determined as the Abadi government is in trying to keep Turkey out, the stakes are equally high for Ankara to maintain, even expand, its footprint in Iraq. But the odds are no longer in favor of Turkey to claim a share of the Iraqi scene.

From Ankara’s perspective, Turkey’s role in Iraq is a necessity: Northern Iraq serves as a launching pad for the secessionist Kurdistan Workers’ Party (P.K.K.) in its operations into the Turkish southeast, as well as a bastion for ISIS. Read more importantly, while Ankara had condoned a major, even primary, role for Iran in Iraq, it has been witnessing the expansion of such a role to a quasi-exclusive one, transforming Baghdad into a mere vassal of Tehran.

Turkey is indeed maintaining a pro-active role in its troubled southeastern neighbors, but there is a notable shift in priorities. Turkey has been humbled by a series of recent consecutive events, in particular the July 15 attempted coup, which has exposed the internal vulnerabilities of President Recep Tayyip Erdogan’s government. It has undoubtedly been forced to reconsider its external policy options. Rather than retreat and introversion, however, Turkey is remaining engaged, albeit with a more modest approach.

A decade ago, at the height of the Turkish economic expansion heralded by Erdogan’s A.K.P., it was tempting to reconsider Turkey as a leader in its regional context. Some thoughtful reflections, from academic and practitioners alike, even contemplated the rise of a neo-Ottomanism, a regional order in which a resurgent Turkey will restore its influence in large swathes of the Muslim world, with a policy of cooperation, moderation, and civic engagement. For some detractors, this was merely a crude cover for a Turkish hegemonism to be resisted and rejected. Yet, Turkish public diplomacy, extending no-visa access to much of the target population, and showcasing Turkey as a productive symbiosis between democracy and Islam in the pursuit of prosperity, seemed to confirm the neo-Ottomanist hopes.

Few, if any, in Turkey, hold on today to these rosy expectations. Instead, what was an optimistic project of outreach has metastasized into reactive policy measures intended to stem the spillover effect from the degeneration of the Syrian and Iraqi situations into Turkey proper. Turkey’s detractors may see in its attempts at creating a strip controlled by friendly militias at its border with Syria, and the steps taken to affect the course of the expected Mosul battle, a continuation of Ankara’s neo-Ottomanist dreams. A more charitable, less polemic, assessment may recognize these actions as defensive measures against a cross-border reality increasingly threatening to Ankara.

In Syria, the Obama administration has settled on Kurdish militias as its proxy boots-on-the ground force in its ongoing low energy war against ISIS. In addition to the contentious nature of the choice, which posits Kurdish fighters as potential ‘liberators’ of Arab-majority areas, the anointed Kurdish militias are both strategic allies of the P.K.K., and proponents of an assertive, even aggressive, Kurdish autonomy in much of northern Syria. From Ankara’s perspective, the Obama administration, which had failed to support Turkey’s calls for allied action in Syria, was effectively enabling Turkey’s sworn enemies.

In Iraq, the failure of Turkey to maintain its role as a respected interlocutor with the Baghdad government lies primarily with the Turkish leadership itself. Through his 2011 visit to Grand Ayatollah Ali al-Sistani, Iraq’s towering Shiite cleric, Erdogan had positioned himself, and Turkey, at an equal distance from the many parties of Iraq’s fractured political landscape. However, soon afterwards, his image was eroded by a series of positions interpreted by many Iraqi Shiite politicians as sectarian and meddling in Iraqi internal affairs. While Erdogan may have been maneuvered into some of these political stands, Turkey was demoted in Iraqi politics from a potential counterweight to Iran into the backer of increasingly marginalized groups and individuals. Paradoxically, the one productive relationship that Ankara succeeded in maintaining in Iraq was with the leadership of the Kurdistan Regional Government.

Meanwhile, with Ankara downgraded, Arab capitals proving incapable of asserting presence, and Washington absconding, Tehran capitalized on the sense of abandonment haunting Baghdad to strengthen its already firm grip on Iraq’s political process. The containment of and eventual push-back against ISIS was possible only with the support of Iranian-backed militias, now re-christened as Popular Mobilization Units (P.M.U.) under nominal Iraqi government control. The price Baghdad had to pay to be saved from ISIS was to submit to a new reality of diluted sovereignty and parallel security arrangements, with Iran as the final arbiter.

For Ankara, and other regional capitals, what is alarming is Washington’s acquiescence to the new reduced Iraqi sovereignty, even its acceptance to co-exist with Iranian hegemony, provided that Iranian proxies serve as foot soldiers in the U.S.-led effort to defeat ISIS. As with the Kurdish militias in Syria, Washington may score immediate victories through its reliance on P.M.U. forces in Iraq. The longer term cost, in both cases, however, would be the seeding of further conflicts, a Kurdish-Arab one in Syria, and Sunni-Shiite one in Iraq.

Turkey may have sought to replicate the formula used by Iran, albeit at much smaller scale. In sponsoring and training local Sunni forces in Iraq, Ankara would fulfill its re-calibrated national interest in containing both the ISIS and the P.K.K., while advocating that a reliance on these forces for the battle of Mosul may provide more long-term positive prospects. Unfortunately, the current bandwidth allocated by the United States for the region seems to be too limited for such advocacy to reach Washington ears. Read more dramatically, Ankara’s attempted entry into Iraq may be a case of too little too late. It is neither able to raise a force that could supplant P.M.U., nor is it capable of copying the verisimilitude of legitimacy enjoyed by Iran’s proxy forces. It may be able to maintain its presence in Iraq, but the vocal objections of Baghdad, who otherwise tolerate a far more acute breach of its sovereignty by Iran, will continue unabated.