Jihadi violence has stalked the Putin administration. A week before he became prime minister in 1999, al-Qaeda-linked militants invaded Dagestan. The week he became prime minister, a mysterious series of explosions ripped through apartment buildings across Russia. Putin’s forceful response — a full-scale invasion of Chechnya, accompanied with rousing speeches to the troops on the frontline — transformed him from a relative unknown to Russia’s most popular public figure in a matter of months.

By the end of the year, Boris Yeltsin had stepped down, elevating Putin to the presidency. For the next two decades, the Russian fight against radical Islam would be a constant of Putin’s rule. His evolving strategy would move from fighting jihadism as an end in itself to a means to broader geopolitical goals, heavily influenced by his misunderstanding of the West.

Yeltsin had left his successor a crumbling state, deeply indebted to oligarchs and battered by scandals exposed by a then-vigorous free press. Putin set about subjugating the media and the oligarchs, earning scorn from Western leaders, who complained about violations of free speech, free enterprise, and the rule of law.

Russia’s jihadi enemies meanwhile engaged in acts far more despicable than any the West had known up to that point. Take Shamil Basayev, a Chechen who in 1995 stormed a hospital and killed more than 100 patients. A few months later, he planted radioactive material at public parks across Moscow. How could the West criticize Russia for dealing with an enemy whose evil it could hardly fathom?

All that changed on September 11, 2001. Basayev had trained with al-Qaeda in Afghanistan and his lieutenant, Omar Ibn Khattab, had fought for an al-Qaeda battalion in the Tajik Civil War from 1992–1997. Putin was one of the first world leaders to call U.S. President George W. Bush to offer support after the 9/11 attacks, and declared his intention of joining “an effective alliance of countries to combat this problem [jihadism] and to keep it going for a long time.” Putin arranged for the Americans to have access to an airbase in Kyrgyzstan for operations against the Taliban, whose defeat he eagerly welcomed.

The alliance would be short-lived, however. In 2002, Chechen rebels seized a theater in Moscow, instigating a standoff that would leave 175 dead. In 2004, forces loyal to Basayev took over a school in Beslan in the North Caucasus, with the ensuing rescue operation leaving more than 300 dead. American and British journalists, who the Russian leadership viewed as an extension of the U.S. and U.K. states, reported on the failings of Russian special forces in each crisis, tying their ruthless tactics to the staggering death tolls. In between, the United States had invaded Iraq, partly on the pretext of fighting al-Qaeda. An element of the case was the assertion that Chechens linked to Abu Musab al-Zarqawi were preparing chemical weapons. Russia’s leadership, which intimately knew Chechen capabilities and maintained close ties with the Iraqi dictator Saddam Hussein dating back to Soviet times, met American claims with deep incredulity.

The West’s criticism of Putin’s handling of Chechnya and the shaky justification for invading Iraq sowed doubts about the West’s motives, leading — in a manner that was to become all-too-familiar — to a deeply cynical conclusion. By 2004, Putin, along with his Western cheerleaders, openly mulled that the West was supporting jihad. “Even I thought that with the end of the ideological barrier in the form of the Communist Party’s monopoly on power, things would change radically,” Putin would recall in a later interview. “But it turns out […] there are geopolitical interests not linked to any ideology at all.”

Russian-Western relations continued to sour with the invasion of Georgia in 2008 and a spate of social media-enabled “color revolutions,” starting with protests that undid a pro-Russian electoral victory in Moldova in 2009, which were followed by popular uprisings in the Arab World from 2010-2011. The West hailed the revolutions as organic cries for freedom, while Russian leaders called them “coups from the outside” and “information warfare.” When the wave of revolutions reached Syria, President Bashar al-Assad portrayed the protestors as jihadi radicals against whom his regime was the only bulwark, a framing soon used by Russia to justify weapons shipments and reinforcements to its naval base in the Syrian port of Tartus.

The same year, Putin denounced NATO intervention in Libya, warning that its military action extended beyond the United Nations (UN) mandate and would lead to chaos. As the chaos in Syria and Libya did indeed worsen, the Russian leadership concluded that Western policy was, at best, indifferent to the power vacuums where jihadism flourished.

Meanwhile, Russia’s brutal confrontation with domestic jihadis found an echo in Syria, where hundreds of its citizens from the Caucasus, and Central Asian migrant workers recruited from Moscow, poured in to participate in a holy war.ISIS drew more foreign fighters from Russia than from any country save Tunisia or Saudi Arabia.

Yet there was no mention of this in 2015 when Russia used the West’s post-Iraq paralysis to enter the war and save Assad. Although Russia did attack ISIS, its aircraft more often targeted more moderate elements ineffectually backed by the West, helping to make Assad’s war for dynastic survival a choice between the old guard and radical Islam. By 2017, Russia had decisively turned the tide in western Syria in Assad’s favor. The next year, disabused of any ideological repulsion to jihadis, Russia began weapon shipments to the Taliban.

In 2001, Putin had aided and welcomed the defeat of the Taliban, sensing a global coalition against the jihadi threat that had stalked the early years of his presidency. In the Russian telling, American Machiavellianism made such an alliance impossible and rationalized the Kremlin’s tolerance of jihadism to achieve larger geopolitical objectives.

But Putin’s assertion that the West wielded the specter of jihad solely to grab power may stem less from Western actions than from imputing to his rivals his own worldview. The authorities had blamed the fortuitously timed bombings of Putin’s first week in office on Chechens, but that story soon unraveled. FSB agents were caught in Ryazan planting the same explosives that had been used in earlier attacks. Reporters investigating the story were killed and a channel that aired interviews with Ryazan residents was threatened with termination.

When asked by French newspaper Le Figaro if he believed the operations to be state-orchestrated, former National Security Council chief Alexander Lebed responded, “I am almost convinced of this.” For Putin and Russia’s leadership, despite their cries of American perfidy, terrorism as a pretext for power politics was there from the start.