The date July 12, 2019, is likely to stay in the annals of Turkish diplomatic history. In the morning hours, two Russian transport planes delivered the first batch of components for the S-400 air-defence missile system to the Murted airfield on the outskirts of Ankara.

Procured from Russia, against vehement objections by the United States, the delivery seals security and defence ties between Moscow and Ankara. It also raises the risk of sanctions against Turkey, a key ally within NATO and long-standing US partner in the Middle East, the Black Sea area and in Southeast Europe. Ankara is facing a real threat of being ejected from the international consortium behind F-35, an advanced fighter jet which is set to provide the bulk of US airpower in the decades to come.

Turkish defence sector companies are also in danger of punishment under the Countering America’s Adversary through Sanctions Act (CAATSA). Passed by Congress two years ago with overwhelming bipartisan support, the legislation provides for penalties for countries engaging in defence deals with Russia, Iran and North Korea. At their harshest, sanctions could take a toll on the growingly fragile Turkish financial system, shutting it from US and international money markets. In addition, they would symbolically relegate Turkey from an ally to an associate of states US views as rogue.

Fears in Washington of Turkey changing sides are not altogether misplaced. The deployment of S-400s, Moscow’s most advanced anti-aircraft system designed to keep the US and its allies in check, would facilitate the gathering and transfer of sensitive data to the Russians. A breach of F-35s stealth technology would deny America and its closest partners, such as Israel, Japan, South Korea, Australia, Canada, the UK and others, the strategic edge they have over their adversaries. Turkey’s repeated assurances that it would operate the missile system alone, relying on its own software and military and technical personnel, have thus far failed to convince many people on the banks of the Potomac.

The assessment that Turkey is now effectively wedded to Russia in strategic terms is not justified, however. Ankara’s geopolitical vision remains unaltered. The Turkish leadership, President Recep Tayyip Erdogan and his entourage first and foremost, believe in their country as an autonomous player using links to both the West and Russia to its own advantage.

Turkey embraced Russia largely as a result of its intervention in Syria. The US support for the Kurdish militias in the northeast compelled Erdogan to pursue rapprochement with both Russian President Putin and the Iranians. Suspicions over the US stance in the coup attempt on July 15, 2016, have fed into the burgeoning ties with Russia, too. Commentators link Erdogan’s steadfast resolve to see the S-400 deal as an attempt to guarantee the government’s safety in the event of another coup. As it happens, the Murted (Akinci) base served as a launching pad for attacks against the Grand National Assembly and the National Intelligence Service (MIT) by rogue pilots three years ago.

But that is only part of the story. Turkey and Russia are at odds on a number of issues. In Syria, for instance, Turkey-armed rebels in Idlib recently thwarted the onslaught by Bashar al-Assad‘s forces backed up by the Russian air force. As the Russian-Turkish agreement on Idlib reached through the Astana process is falling apart, Ankara has decided to show its teeth. Another example is certainly NATO enlargement. This week Turkey’s parliament ratified the accession protocol of North Macedonia. For the past year, the small Balkan republic has been the target of a Moscow-backed campaign against NATO membership, which has been waged through domestic proxies and pro-Kremlin information outlets. Turkey also contributes to the Atlantic Alliance power projection in the Black Sea aimed at balancing Russian expansion. Its navy took part in this year’s Sea Breeze exercise which involves 19 states, including the US, NATO members, Ukraine and Georgia. In short, Turkey is both cooperating with but also hedging against the Russians.

Erdogan’s preference to play both sides is hardly a problem for Russia. The rift between Turkey and the US is a sufficient geopolitical prize. Tensions are sure to rise in the coming days and weeks. The Turkish president has been hoping to clinch a compromise by talking directly to Donald Trump. Last time, the two appeared side by side, during the G20 summit in the Japanese city of Osaka, the chemistry was rather positive. Trump appeared to show understanding of the Turkish position. He furthermore conveniently blamed the S-400 purchase on the Obama administration’s reluctance to sell the Turks Patriot missiles. In contrast, last December, the State Department endorsed an offer for a batch of Patriots worth $3.5bn. Even if the Turkish government is not changing its minds, dropping the S-400s in favour of the US-made missiles, the Trump administration has a good story to tell why it is taking a softer line on Erdogan. Turkey hopes that the White House might intervene to suspend and even waive sanctions, exercising its authority under CAATSA.

Time will show whether this plays out the way Ankara wants it. The question of how to respond to Turkey might become yet another battleground in US domestic politics. Congress will likely push back against attempts by the Trump administration to patch things up. It has already pushed forward bills to make sure Turkey is out from the F-35 consortium. It won’t come as a surprise if a number of Republicans in the Senate part ways with the president. There will be pressure for a tough response to Erdogan from within the administration, too. Years of friction in bilateral relations have left Ankara with few friends in the corridors of power in the US capital. Faced with an internal insurgency, Trump, erratic as he is, could end up changing his tune on Turkey.

For a long time, Turkey has managed to pull off a delicate balancing act. It cultivated diplomatic, security and economic ties with Vladimir Putin’s Russia, while keeping its place in the Western alliance. A major rupture with the US is looming on the horizon, however. With compromise becoming ever more elusive, it could have lasting consequences for Turkey’s foreign policy and role in international affairs.

The views expressed in this article are the author’s own and do not necessarily reflect Al Jazeera’s editorial stance.