MOSCOW - President Vladimir Putin has imposed the Kremlin's writ on every corner of Russia except one: the Chechnya region, whose leader, Ramzan Kadyrov, often pays little heed to the rules that govern the rest of the country.
Putin is now trying to rein Kadyrov in, though alienating him would risk reigniting an Islamist insurgency that he helped the Kremlin leader defeat.
A former Islamist rebel who has ruled the turbulent, mainly Muslim region in Russia's North Caucasus since 2007, Kadyrov swears loyalty to Putin.
Those public expressions have helped Putin turn a blind eye to Kadyrov's idiosyncrasies, which include enforcing a strict Islamic "code of virtue," embarrassing the Kremlin with verbal attacks on opposition politicians, and employing methods against insurgents that human rights groups see as rights abuses.
But he is widely reported to have opponents in the Kremlin and an opportunity has presented itself to put him in his place: The 39-year-old Chechen leader's term in office runs out in April, and he needs Putin's approval to stay on.
"For too long, the argument goes, Kadyrov has been allowed to run things his own way," said Alexander Baunov of the Carnegie Moscow Center think tank. "Moscow's elite have been increasingly looking to subordinate Chechnya to Putin."
Asked in February what would happen to Kadyrov when his term expired, Kremlin spokesman Dmitry Peskov said it was up to the president to decide who runs Chechnya.
"Is the structure there different in any way from other regions?" he said. "Let's not forget that this is a region of the Russian Federation, where all the laws of the Russian Federation apply."
A Chechen government spokesman did not return calls seeking comment on the expiration of Kadyrov's term.
Kadyrov and his father, Akhmad, were part of a separatist insurgency that fought Moscow's rule in Chechnya in the 1990s. The family switched sides and Akhmad Kadyrov became Chechnya's pro-Moscow leader in 2003 but was assassinated in a 2004 bomb attack. His son, who had been his head of security, was groomed to take over.
Since he was formally appointed by Putin in 2007, Ramzan Kadryov has overseen the rebuilding of the Chechen capital, Grozny, devastated in 1994-96 and 1999-2000 wars by Russian forces intent on keeping Chechnya in Russia.
The reconstruction was bankrolled by Russia and the city now hosts Europe's largest mosque, a multimillion-dollar soccer stadium and a modern skyscrapers complex.
Some in Chechnya see the re-emergence of the city, and the peace that made it possible, as a tribute to Kadyrov, whatever his methods.
But under his rule, Chechnya often seems to operate under its own laws, an anomaly in the rigid system of rule built by Putin in which most regional leaders are Kremlin ciphers.
Chechnya's authorities force women to cover their hair in public spaces and buildings, and they ignore harassment of women deemed to be dressed immodestly, New York-based Human Rights Watch says. Those practices run counter to Russian rules on religious freedom.
According to Russian media reports, on several occasions when Russian federal law enforcement agents have entered Chechnya in pursuit of suspects, their path has been blocked by armed men loyal to Kadyrov.
Matters of style
Kadyrov's style makes some in the Kremlin uncomfortable. He casts himself in the role of a warrior leader whose mission is to uphold Islam and Chechnya's national identity, within Russia.
He attended the wedding of a middle-aged local police chief to a 17-year-old girl last year, a match that was in line with Chechnya's patriarchal moral code but clashed with social norms in other parts of Russia.
His Instagram account mixes images of him at official meetings with shots of him cuddling a lion cub, praying, working out in a gym and attending boxing matches. He sometimes wears suits but more often dresses in a track suit, or camouflage fatigues. Pets he has owned include a lion.
In December last year, a Chechen woman, Ayshat Inayeva, wrote on social media that ordinary people were living in poverty while Kadyrov's circle led extravagant lifestyles. Soon afterward, Kadyrov brought Inayeva and her husband to his office and gave her a dressing down that was broadcast on Chechen television.
Rights activists say there is a darker side to Kadyrov's style. They point to the deaths, disappearance and torture of critics and rivals of Kadyrov, and allege that forces loyal to Kadyrov are responsible. He has denied that.
He is also now on Western sanctions lists after voicing strong support for Russia-backed separatist rebels fighting government forces in eastern Ukraine and for Russia's annexation of the Crimean Peninsula from Ukraine in 2014.
Moscow's patience with Kadyrov had its biggest test after opposition figure Boris Nemtsov was shot dead in February last year near the Kremlin.
People familiar with Kremlin thinking said the shooting shocked Putin because it suggested someone was operating outside his control right under his nose.
Kadyrov denied he or his lieutenants were involved, but he described one of the suspects, Zaur Dadayev, a Chechen policeman, as a "true patriot" soon after Dadayev was arrested.
Since the Nemtsov killing, Kadyrov has felt a cooling in the Kremlin's attitude toward him, according to Yekaterina Shulman, a political scientist at the Russian Academy of Science's Institute of Social Sciences.
Kadyrov believes "someone is whispering bad things to the president, trying to persuade him to replace the boss in Chechnya," Shulman wrote in Russia's Slon magazine.
The Chechen leader has shown signs of being insecure about his position. He has launched scathing attacks on figures in Russia's liberal opposition, saying they should be purged, and he posted a picture of one in a sniper's cross hairs. Several commentators said he did that to show loyalty to Putin.
In January, thousands of people rallied in Grozny. Local authorities said it was a spontaneous show of support for Kadyrov, though several people in the crowd said they had been ordered to turn up.
"Yesterday the head of our faculty told us there will be no lessons today and everyone should be on the main square at 10 a.m. for the rally," Zara, a student, said at the time. "They gave us placards with the words: 'Ramzan is a patriot.' "
Drop in subsidies
Adding to Kadyrov's sense of insecurity is that Chechnya is receiving less in federal subsidies. An economic slump, caused by the drop in world oil prices, is forcing Moscow to cut spending.
Moscow's support is relatively generous. Chechens annually receive about 40,000 rubles ($575.73) in subsidy per head, while the figure is around 10,000 rubles per head for the country as a whole. Aid from Moscow accounts for around 85 percent of the Chechen government's revenues.
But the amount has been falling. In 2011 the federal subsidy earmarked for Chechnya was 69.5 billion rubles. This year it is projected to be 48.5 billion. The cut in real terms is even greater, taking into account inflation, which last year was 12.9 percent.
"I don't rule out that Kadyrov initiated this circus to at least have financing for Chechnya not reduced," Magomed Akhmatov, head of the Communist Party in Chechnya, said of the rally in Grozny.
Removing Kadyrov carries the risk that he, and his heavily armed militias, could declare an open rebellion, reigniting the insurgency in Chechnya.
There is no plausible alternative to Kadyrov. The only pro-Kremlin rival authority in Chechnya was Sulim Yamadayev, a prominent military commander. He was shot dead in Dubai in 2009. Kadyrov denied involvement.
Most observers say Putin will ultimately decide it is too big a gamble to try to push out Kadyrov when their arrangement is still, fundamentally, working.
In the meantime, though, Putin will make Kadyrov wait for a decision on a new term, something of a habit for man who often keeps visiting world leaders waiting and a ploy to reassert his authority over the Chechen leader.