Things kept getting worse for Ilyas Nikitin. Just hours after a deadly bomb attack rattled the St. Petersburg metro on April 3, 2017, Russian media circulated photographs of the suspected terrorist—a bearded, black-clad man wearing what appeared to be an Islamic prayer cap. Nikitin, a truck driver from provincial Russia, was shocked to see his own face flashing on television screens. After clearing his name with the police, Nikitin attempted to board a plane from Moscow to Ufa, the capital of his native region, but passengers recognized him and summarily kicked him off the flight. Later that week, Nikitin’s boss fired him, allegedly at the behest of local government investigators.

Nikitin’s story is not just a cautionary tale about the speed with which false rumors can spread. It also provides a glimpse into the fraught relationship between Russia’s authorities and its Muslim population, against whom discrimination is commonplace.

Officially acknowledged as one of Russia’s four founding religions, Islam is woven into the nation’s cultural and historical fabric. Today, around 20 million Muslims currently live in Russia. In the nearly three decades since the collapse of the Soviet Union, the government has had a complex relationship with Russia’s Muslim communities.

This relationship originated hundreds of years ago, with Catherine the Great.

“Catherine was the first to realize that Russia was no longer a homogenous country, that it was not just Slav Orthodox Christians,” said Shireen Hunter, a professor at Georgetown’s School of Foreign Service and the author of Islam in Russia: The Politics of Identity and Security, in an interview with The Politic. “She realized that somehow you have to bring these peoples in some kind of relationship and, eventually, [institute] not exactly control but definitely supervision of the state.”

Catherine II’s government skillfully co-opted Muslim elites to consolidate control over the empire’s diverse Muslim population and bring the Muslim minority into the fold. But in some instances, Muslims opposed the state’s efforts at assimilation and faced brutal responses.

Hunter explained that maintaining a balance between co-optation and oppression characterized the Russian state’s relationship with the Muslim community until the twentieth century. At that point, the Soviet Union’s policy of state-sponsored atheism momentarily threatened the delicate relationship between Russia and its Muslims.

But by the 1970s, Islamic practice had been revived in Central Asia and Muslim-majority areas. Like Russian governments before, the USSR came to tolerate Islam in order to preserve stability across its vast areas of control.

While the North Caucasus had been part of Russia for centuries, it was never fully integrated. After the collapse of the Soviet Union, Muslim-majority Chechnya, part of the North Caucasus region, declared its independence from Russia.

“You had this separate group [of Muslims] in the North Caucasus which was brought into the Russian empire in a very long, violent campaign in the nineteenth century,” said Thomas Graham, former Director of Russian Affairs on the National Security Council and the current co-director of the Russian Studies Project at Yale, in an interview with The Politic.

The historical opposition to Russian control came to a head in the brutal First Chechen War of 1994-1996 as Russia moved to re-assert its authority over the region, which is predominantly Muslim. As civilian casualties mounted and reports of Russian atrocities became more common, Chechen separatists began to adopt unconventional and sometimes violent tactics, surprising Russian forces in ambushes and resorting to hostage attacks in mainland Russia. Chechen separatism remained powerful until 2009.

While Russia was ultimately able to control Chechnya politically, it has still struggled to contain terrorism. Since 1992, nearly 4,000 Russians have died in almost 900 lethal terror attacks across the country. The April attack on the St. Petersburg Metro was another in a long line of attacks that began after the Chechen conflict.

Despite the recurrence of terrorist attacks, Putin has attempted to restore the delicate balance that once characterized the relationship between Russia and Muslim minority groups.

In an interview with The Politic, Michael Khodarkovsky, a professor of Russian history at Loyola University Chicago, compared the current administration’s strategy to that of Catherine II’s reign.

Khodarkovsky has written several books examining the relationship between the expanding Russian state and the non-Christian peoples across its colonial frontier. “I think what the Kremlin is doing now is exactly the same [as under Catherine II],” he said. “They want to be able to control the Muslims and make sure they are loyal.”

Since the beginning of his presidency, Vladimir Putin has prioritized engagement with Russia’s various Muslim populations. In 2002, he made a well-publicized visit to the main mosque in Maykop, the capital city of the Republic of Adygea, during Ramadan celebrations. He and Vice President Dmitry Medvedev continue to visit mosques regularly, and Putin often publicly wishes Muslims well during Islamic holidays.

Despite Putin’s efforts, though, the Russian government’s relationship with Muslims remains complex. Hunter underscored the impossibility of forging relationships with a single, unified Muslim Russian community.

“We cannot and should not talk of Muslims as a monolith because, unfortunately, we tend to think that the people who proclaim Islam as their faith don’t have other loyalties,” she said. “That’s not true, and in particular I think we have to keep in mind issues of ethnicity and ethnic and historical rivalries.”

For Muslims in Russia, religion and ethnicity are inextricably linked.

“Russia, as an heir to an empire, has inherited all these complex ethno-territorial structures,” Khodarkovsky noted. “The problem with Russia, and this is a very unique problem, certainly compared to any Western society, is that the ethnic minorities live in compact territorial enclaves.”

Russia’s Muslim population can be broken down into three distinct groups. Graham explained that native Muslim populations are concentrated in a set of semi-autonomous republics. These republics consist of the Volga-Ural region, which includes Tatarstan and Bashkortostan, and the North Caucasus, which includes Chechnya and Dagestan. A third group has developed in the megacities of mainland Russia.

These groups are not static. The last two decades have seen a new wave of Muslim arrivals in Russia. Economic problems have been partially responsible for the spike in immigration from Central Asia that began in the early 2000s, according to Graham. This influx has caused a host of problems for the Russian state.

“Even if the Russian government is trying to integrate the Muslim community into the Russian state and political system, the migrants that come from Central Asia are not Russian citizens,” he said. “They’re foreigners. They get exploited the way illegal immigrants get exploited all the world over.”

Russia desperately needs cheap, migrant labor as its population ages and its workforce shrinks.

Andrew Movchan, director of the economic policy program at the Moscow Carnegie Center, explained in an interview with Bloomberg, “If you take out the migrants, who comprise 15 percent of the Russian workforce, it will be impossible to replace them.”

But the influx of migrants has led to a marked rise in xenophobia across Russia.

“It’s not dissimilar from the attitudes that you have in some parts of the United States, though we’re dealing with a different migrant population as opposed to Russia,” said Graham. “But we’re dealing with the same sort of attitudes. You do need [the migrants], they do occupy an important niche in the economy, but you do also get the nativist reaction.”

Putin’s strategy has been an extension of the kind of co-optation and integration pioneered by Catherine II nearly three centuries ago.

Putin’s alliance with the Eastern Orthodox Church has manifested primarily in his embrace of “traditional” values—his resistance to multiculturalism, radical feminism, gay rights, etc.—in the face of Western liberality gone wild. Values that also appeal to the Muslim community in Russia.

When asked if Muslims support Putin’s embrace of traditional Orthodox values, Hunter said, “Muslims love it.”

He continued, “On social issues, I think the Church and Muslim leadership will definitely agree and support Putin. Basically they want a more communitarian and more “moral’ society.”

“The Kremlin has largely succeeded in making Islam a solid pillar of Putin’s system of governance, albeit one that’s hardly been noticed outside of Russia,” said Robert Crews, a professor of history at Stanford and an expert on Russia and Islam, in an article for the World Politics Review.

Putin is seeking political support in an unlikely place. But with an eye to history, it is not so unlikely after all.