The rhetoric around the long-standing friendship between Russians and Kazakhs is a vestige of Soviet historiography, which emphasized the “voluntary” submission of the Kazakh khans to the Russian empire in the 19th century. But Kazakhs were in more or less continuous rebellion against Russia from the 18th century through the 20th, as Russian settlers inexorably encroached upon the nomadic Kazakhs’ traditional grazing grounds. The Kazakhs were ultimately too weak to withstand the Russian advance, however, and were forced to accommodate Russia’s demands that they submit politically and give up nomadism.

Today, that story is being retold: Kazakhstan is under economic pressure from Russia, in the form of Moscow’s “Eurasian” integration projects, most notably the Eurasian Economic Union (EEU), which was formally created in May in Astana and includes Belarus, Kazakhstan and Russia. The timing of the signing, coming in the wake of the annexation of Crimea, was awkward for Kazakhstan. Rare nationalist protests have criticized the EEU as an abdication of Kazakhstan’s sovereignty, while Nazarbayev has repeatedly insisted that the union is only economic and not political.

And just as Nazarbayev has had to delicately balance the desire to Kazakhify the country with the need to avoid alienating its ethnic Russians, he’s carried out a parallel balancing act with respect to relations with the Russian government. Since gaining independence, Kazakhstan has striven toward what it calls a “multi-vector foreign policy,” which is a delicate way of explaining that it seeks new partners — primarily China, the U.S. and Europe — to balance out the Soviet-era dependence on Russia.

To that end, Kazakhstan has enlisted European and American companies to exploit its oil and natural-gas fields. With the income from those resources it has been sharply increasing its military spending, and has increasingly been buying European, Chinese and Turkish hardware to replace the exclusively Russian equipment it inherited from the Soviet Union. And it has been trying to gain more control over the Soviet-legacy military and space facilities that Russia still operates in Kazakhstan, including the legendary Baikonur space launch site. It has done all this while still managing not to appear as a threat to Russia, by not making the advances toward the European Union or NATO that convinced Russia that Ukraine was turning into a geopolitical problem.

But the events in Ukraine have thrown this delicate balancing act into question. Kazakhstan's initial diplomatic response to the annexation of Crimea was cautious to the point of incoherence. In a telephone call with German Chancellor Angela Merkel, Nazarbayev stressed the importance of Ukraine's “territorial integrity,” while in a phone call with Russian President Vladimir Putin the same day, he said he “understands Russia’s stance on protection of the rights of national minorities in Ukraine and its security interests.”

Soon after Russia annexed Crimea, the Kazakh government announced that it intended to introduce laws punishing “illegal and unconstitutional calls for changes to the territorial integrity of the Republic of Kazakhstan” by up to 10 years in prison. And it promised to make it easier for ethnic Kazakhs from outside Kazakhstan to gain citizenship.

“The situation in Ukraine clearly rattled a lot of people here,” said one Western diplomat in Astana, speaking on condition of anonymity. (The Kazakhstan Ministry of Foreign Affairs declined to comment for this article.)

There is a broad consensus that as long as Nazarbayev is in charge, he has built up enough trust with Moscow and Kazakhstan's ethnic Russians to withstand a crisis. But he is 73 years old, and what happens when he is replaced is unclear. While some in Astana believe he has nurtured deep roots for his moderate policy, others worry that in an uncertain succession, nationalists could come to power. That, in turn, would badly frighten both Moscow and Kazakhstan’s ethnic Russians.

“One can easily imagine a future hysteria around ‘a Russian genocide,’ now in Kazakhstan, when instead of the ‘Benderovtsy’ the bogeymen are ‘basmachi,’” wrote one Russian analyst, Mikhail Kalishevskiy, on the Moscow-based website Fergana News. (“Benderovtsy” were Ukrainian nationalist partisans who fought Soviet rule in World War II and after; Kremlin rhetoric has relied heavily on the alleged threat of their return in today's Ukraine. “Basmachi” were Central Asian rebels who resisted the imposition of Soviet rule in the 1920s.)

“As long as [Nazarbayev] is president, there won’t be any big problems,” Zakharov said. “But if, God forbid, something happens to him, there is no guarantee. There will be trouble, I’m sure of it.”

Editor's note: This version of the story corrects the name of Chokan Valikhanov and removes a reference to a requirement that students at Nazarbayev University pass a Kazakh-language exam.