This is also bound to affect Turkey’s own Kurds, which could result in a serious loss of support for President Recep Tayyip Erdogan and his Justice and Development Party in the presidential and parliamentary elections planned for 2019.

One major risk is that Turkey’s aggressive approach to the Iraqi Kurds will result in uniting diverse Kurdish groups in Iraq and Syria against Turkey even if these groups have major disagreements among themselves.

Seasoned diplomats, taking into account that there have been so many Turkish policy failures in the Middle East since 2011 due to miscalculations and mistaken predictions, warn that Ankara could end up misplaying its hand again.

However, Barzani has let the Kurdish genie out of the bag, and Ankara will have to manage this with diplomatic subtlety to not end up with another regional debacle on its hands.

Kurdistan Regional Government (KRG) President Massoud Barzani appears to have painted himself into a corner with his independence referendum . Turkey is more than happy with this and pleased that the KRG referendum was rejected by the international community.

Like the Qatar crisis, this one also caught Ankara unaware. Barzani’s desire to hold a referendum was known in Ankara, of course. Nevertheless, Erdogan admitted that he did not believe it would go ahead.

This mistaken belief is driving his angry reaction toward Barzani, who until recently was among Erdogan’s closest regional friends. The realization of the complexity of the situation, and the limitation to what Ankara can really do to bring Barzani back in line, however, seems to be also pushing Erdogan toward a more moderate tone.

He told parliament Oct. 1 during the opening of the legislative year that if the KRG undid its mistake, it would continue to enjoy Turkey’s support.

“Our greatest desire is for the matter to be resolved calmly and reasonably. When the administration in northern Iraq acts virtuously and corrects its mistake, Turkey, as a state and nation, will continue to support these brothers of ours,” Erdogan said.

Erdogan has not given up on his threat to use military force against the KRG, despite the major obstacles such a move would face.

Retired Ambassador Osman Koruturk, whose past diplomatic postings include Bagdad, said the “toothpaste is out of the tube” with this referendum. “No matter how much pressure you apply, it won’t be possible to turn the 92.7% yes vote into a no vote,” Koruturk told Hurriyet in an interview.

Koruturk, who also served as special envoy to Iraq from 2003-2005, added that it was wrong to threaten the KRG militarily, saying it would also be wrong to isolate Barzani and his administration.

Pointing to diplomacy as the only way to move forward, Koruturk said trying to solve this crisis by military means “would only result in clashes that produce uncertain results, last long and completely destabilize the region.”

Economy Minister Nihat Zeybekci has warned that sanctions against the KRG would also result in serious economic losses for Turkey, since the bulk of its trade with Iraq — Turkey’s third largest trading partner — is with the KRG.

Zeybekci’s remarks, however, were not in tune with Erdogan’s angry warnings and reflected a lack of coordination in Ankara over the KRG referendum.

Meanwhile, Ankara is also noting that the United States and Russia are hedging their bets on this referendum, even as they express their disappointment with the KRG for holding it.

What Washington and Moscow say about the need to maintain Iraq’s unity is in line with Turkey’s position. US and Russian caveats, though, reveal nuanced differences and suggest that they will oppose Turkey — or Iraq and Iran for that matter — if threats of military action are carried out against the Iraqi Kurds.

US Secretary of State Rex Tillerson said in a written statement that Washington will not recognize the KRG referendum, but also added that the United States was asking “all parties, including Iraq’s neighbors, to reject unilateral actions and the use of force.”

Koruturk also warned against relying too much on Washington in this crisis. “The main concern of the US seems to be the fact that the fight against the Islamic State is not over yet. I don’t know what it will do after it is over. I have my doubts that it would oppose a Kurdish entity there,” Koruturk said.

Hurriyet’s Washington representative Cansu Camlibel also points to the fact that Ankara and Washington “are not on the same page” regarding the KRG referendum.

“The US objection to the independence vote was mostly about timing,” Camlibel argued in her column, adding, “For Turkey, any vote for an independent Kurdistan presents an existential crisis.”

“US policymakers believe it is important not to antagonize Kurds, even if they needed a little bit of shaking,” she said, adding that Washington would most likely oppose moves by Ankara such as sealing the border with northern Iraq or taking military measures against the KRG.

“The US is deliberately taking that road of ambiguity in order to keep an upper hand in the tough negotiations ahead for the future of Iraq. Perhaps Ankara should try to adopt a little bit of that ambiguity too, rather than committing itself to an impossible mission of eradicating Kurdish aspirations from the face of the earth,” Camlibel said.

Turkey is also not all that happy with the official Russian position on the KRG referendum, even though Erdogan and President Vladimir Putin announced in Ankara last week that they are in agreement on the topic.

“We maintain our unwavering commitment to the sovereignty, unity and territorial integrity of the friendly Iraq and other Middle Eastern states,” Moscow said in its official statement last week. It pointed out immediately, however, that “Moscow respects the national aspirations of the Kurds.”

Neither Washington nor Moscow has closed the door on some degree of autonomy for the Syrian and Iraqi Kurds. Having secular Kurds holding parts of northern Syria and Iraq, instead of radical Sunni groups who are still believed to be getting support from Turkey, will be preferable for Russia and the United States, said a Western diplomat speaking to Al-Monitor off the record.

Syrian Foreign Minister Walid Moallem’s recent remark that autonomy for the Syrian Kurds was “negotiable” has only added to the complexity of the situation for Ankara.

Ankara appears to have cast aside its significant differences with Tehran and Baghdad over regional issues for the moment and is relying on their cooperation against the Iraqi Kurds.

Erdogan discussed the matter with Iraqi Prime Minister Haider al-Abadi over the phone, and he will be in Tehran this week for talks with Iranian President Hassan Rouhani, during which the topic will be a key agenda item.

Prior to Erdogan’s arrival, Gen. Hulusi Akar, Turkey’s chief of General Staff, was in Tehran for talks with his Iranian counterpart. Joint military action by the two countries against the KRG, however, is considered to be highly unlikely, given that neither Washington nor Moscow would allow this.

Washington is also expected to prevent Baghdad from linking up with Ankara and Tehran to move militarily against the KRG.

The bottom line is that for all the dire warnings emanating from the Turkish side, Barzani has thrown the spanner in the works for Erdogan, who already had enough regional headaches. Erdogan will now have to cope with this one, while ensuring minimal damage not just to Turkey’s interests but also to his own party’s interests.