Russian President Vladimir Putin meets with Ali Akbar Velayati, a senior adviser to Iran’s Ayatollah Ali Khamenei, in July. (Alexei Druzhinin/Sputnik/Kremlin Pool/AP)
Robert G. Rabil is a professor of political science at Florida Atlantic University.

In its zeal to undermine the Iranian regime, the Trump administration is unwittingly helping to forge an Iranian-Russian-Turkish axis, to the detriment of U.S. power in the Middle East.

This alliance isn’t natural: Russia has had a conflicted relationship with both Iran and Turkey dating from the days when Czarist Russia squared off against the Persian and Ottoman empires. But it has the potential to shape a new regional order — and cost the United States its long-standing predominance in the Middle East.

The historical conflict between Russia and its two new allies began during relentless struggles over the Caucasus region, the site of countless border conflicts. The victory of Czarist Russia over the Ottomans in the Crimean War in 1774 allowed Moscow to extend control over the North Caucasus region, including Chechnya, Dagestan and Ingushetia. Similarly, by defeating the Persian Empire in wars between the 17th and 19th centuries, Czarist Russia made substantial territorial gains, including the current states of Georgia, Armenia and Azerbaijan.

The defeat of the Ottoman Empire in World War I and the emergence of Turkey from its ashes stabilized the malleable borders between Turkey and Russia. But while the border wars calmed, the outbreak of the Cold War and the admission of Turkey into NATO constricted the relationship between Moscow and Ankara because United States underwrote Turkish security.

During that period, the relationship between Iran and Russia was stormy. Moscow supported the secession of northwestern Iran at the end of both world wars. Russian and British forces invaded Iran during World War II. And the Soviets supported the Tudeh (Iranian Communist) Party during the rule of Shah Mohammad Reza Pahlavi.

The 1979 Iranian revolution didn’t reduce this tension. The new leader of the Islamic republic, Ayatollah Ruhollah Khomeini, condemned his atheist neighbor to the north and called the Soviet Union the “Lesser Satan” in relation to the American “Great Satan.” Accordingly, Russia, fearing the appeal of revolutionary Islam to its Muslim population, armed and advised Iraq during the Iran-Iraq War of 1980-1988.

The downfall of communism and the disintegration of the Soviet Union ushered in a new era in Russian relations with both Iran and Turkey. The Caucasus reemerged as a focal point of concern for the then-weak Russian Federation. But unlike in the past, Russia reached an agreement with both Iran and Turkey, whereupon both states promised not to meddle in the affairs of the restive Caucasus, especially the North Caucasus.

What changed to turn these enemies into allies? For Iran, it was an opportunity to break free from its containment by the United States, and both Iran and Turkey were concerned about secessionist movements gathering strength if their minorities took inspiration from the resurgent nationalist feelings among Russia’s minorities. This deal paved the way for Russia to sell weapons to Iran and agree to revitalize Iran’s nuclear program, beginning with the completion of the Bushehr reactor.

The litmus test of this budding relationship for Russia was Iran’s noninvolvement in the Chechen wars of the 1990s. Rather than backing fellow Muslims, Iran supported the territorial integrity of the Russian Federation. Russia and Iran also cooperated in bringing an end to the five-year Tajik civil war in the 1990s, and both supported anti-Taliban Afghan forces.

Meanwhile, NATO expansion toward Russia’s borders continued unabated. This only incentivized Moscow to better its relationship with Tehran because Russia feared then-Iranian President Mohammad Khatami’s “Dialogue of Civilizations” approach to foreign policy could lead to an Iranian-Western rapprochement further encircling Russia.

This resulted in a warm, if ambivalent, relationship between the two nations. Vladimir Putin wanted to arm Iran and supported its expanded nuclear program, but he drew the line at Iran acquiring nuclear weapons. Nor did he want to sever Russia’s relationship with United States and Israel. In fact, in June 2010, Russia supported the U.N. Security Council’s increased sanctions on Iran for its lack of cooperation over its nuclear program. Three months later, Moscow reneged on an agreement to deliver the S-300 missile system to Iran.

Everything changed with outbreak of the Arab revolutions from 2010 to 2012. Russia feared Islamist-led mass Muslim mobilization in its provinces, and it worried that the moderate form of Islam present in Russia was under attack by encroaching extreme Islamism and Salafi-jihadism. Putin feared Salafi-jihadists would overthrow the Assad regime in Syria and reinforce their cooperation with Islamist militants from the Caucasus and Central Asia, posing a threat to his control over Russian provinces in the North Caucasus.

These fears were realized as Salafi-jihadists gained the upper hand within the Syrian opposition and posed a lethal threat to the Assad regime. Putin responded with military involvement in Syria.

But Russia wanted to avoid another costly, extended war like the devastating Soviet war in Afghanistan (1979-1989). Enter Iran. Moscow armed, trained and led concerted military efforts with Iran and its proxy Hezbollah against the Syrian opposition. Tehran and its proxies proved indispensable to Russian attempts at turning the war in favor of the Syrian regime.

No less significant, Putin made sure Ayatollah Ali Khamenei, Iran’s supreme leader, and the rest of the world understood past conflicts were behind them and Russia would not forsake Iran. Putin delivered the promised S-300 missiles and began pursuing military, economic and political initiatives to transform the Iranian-Russian relationship into a strategic alliance.

Turkey, by contrast, opposed the Assad regime. However, a combination of factors compelled it to reorient its policy in the region in general and in Syria in particular in the direction of Russian policy there.

Turkey frowned upon U.S. support of the Syrian Kurds, whose leadership and military units are associated with the Kurdistan Workers’ Party, which Turkey and United States consider a terrorist organization. Turkey also opposes the creation of an autonomous contiguous Syrian Kurdish territory on its border and has clamped down on Kurdish activism in Turkey.

Significantly, the Turkish government has accused the United States of not only abandoning Ankara during a botched 2016 coup d’état but also being indirectly involved in the failed coup. Turkey is also holding American pastor Andrew Brunson under house arrest, apparently in reaction to U.S. refusal to extradite Turkish cleric Fethullah Gulen, who Turkish authorities believe was behind the coup attempt. This has led to a deterioration in the relationship between the United States and Turkey, including the imposition of U.S. sanctions on Turkey.

Russia and Iran, unlike United States, immediately expressed support for Recep Tayyip Erdogan’s government.

All of this has coincided with the Trump administration unilaterally withdrawing from the Iran nuclear agreement, snapping back sanctions on Iran, imposing more sanctions on Russia and leading an international effort to compel states, including allies, to abide by the American sanction regime against Iran. It’s no secret that the U.S. goal is regime change in Iran.

This policy, however, is doomed to fail. Not only has it driven Iran, Russia and Turkey together, forming a potentially potent anti-American alliance in a crucial region of the world, but it fundamentally fails to understand what is driving these countries. All three are worried about long-standing vulnerabilities to secessionist and radical movements. This gives them a commonality of interests that the United States is unlikely to match — especially given its current posture — and a unity of purpose to dictate regional policies that are anathema to the United States and its allies.