The Winter Games drew to a close Sunday night in Sochi, as host country Russia extinguished the Olympic flame and passed the torch to South Korea. At one point during the closing ceremony, a group of dancers began forming the five Olympic rings, expanding outwards like the mechanical display that famously malfunctioned during the opening ceremony. Once again, the fifth ring remained closed for a nervous few seconds, before finally expanding to complete the formation.

It was a well-executed moment of self-deprecation, and a rather fitting send-off for Sochi, as well. What began as one of the most controversial Olympics in recent memory — rife with threats of terrorism, alleged human rights violations, and persistent uncertainty — ended without major catastrophe or disruptions, marking what experts describe as an overall success for Russian President Vladimir Putin. But as political unrest continues to unfold across neighboring Ukraine, it's unlikely that the Kremlin will have much time to bask in its Olympic glory.

There was a lot riding on these Olympics for Putin and his allies, both financially and politically. Transforming Sochi into a winter wonderland entailed reported expenditures of $51 billion — far more than any Olympics in history — as the Kremlin sought to showcase Russia's economic might on the global stage.

"It was everything that he hoped for."

"I would like the participants, fans, journalists and all those who watch the Games on television to see a new Russia, see its face and possibilities, take a fresh and unbiased look at the country," Putin told reporters in January.

But experts say Putin's true target audience was domestic rather than international. The president has spent the last few years consolidating support among his conservative base in Russia, after widespread protests against allegedly fraudulent elections rippled across the country in 2011. The government implemented a controversial ban on gay "propaganda" last year, and has gradually tightened its control over independent media, spreading increasingly anti-Western rhetoric. The Olympics, experts say, offered an ideal platform to stoke the patriotic sentiments that have resonated with Putin's right-leaning constituency.

"Domestically, the main goal of the Olympics for Putin was to increase patriotism and connect it to his own rule," Dmitry Gorenburg, senior analyst and Russia expert at the nonprofit think-tank CNA, said in a telephone interview on Friday. "And I think that all indications are that that is succeeding."

Rings

(Adam Rifkin / Flickr)

Leading up to the games, many feared that Putin's Olympic dreams would be quashed by terrorist attacks. In December, suicide bombers killed 34 people in an attack just 400 miles from Sochi, and Islamist insurgent groups in the nearby North Caucasus region vowed more violence during the games. Russian authorities constructed a massive security system around Sochi and all Olympic venues in the region, deploying an estimated 40,000 armed soldiers and 11,000 closed-circuit cameras.

Security forces also used an extensive electronic surveillance program to monitor all communications coming in and out of Sochi, raising concerns among Russian activists and journalists who fear that the Kremlin may have used the Olympics as a pretext for deepening its domestic spying network. For Putin, though, all that matters is that the games came to a close without a violent incident.

"It was everything that he hoped for," says David Wallechinsky, president of the International Society of Olympic Historians. "He gave [Russians] what they wanted, which was gold medals and no incidents."

"The protest zone was a joke."

The Kremlin was similarly wary of protests at Sochi, fearing embarrassment and criticism on the internet. Many LGBT activists called for a boycott of the Olympics over Russia's anti-gay laws, while others tried to raise awareness around alleged labor violations, corruption, and environmental abuses committed during the construction of Olympic venues.

It seemed like Putin would take a more conciliatory approach to dissent in December, when he granted amnesty to jailed high-profile activists like Kremlin adversary Mikhail Khodorkovsky and two members of the collective Pussy Riot, but several protesters found themselves muzzled once the games began.

A prominent environmental activist and Sochi critic was sentenced to three years in a penal colony on allegedly trumped-up charges, while an Italian transgender activist was detained after shouting "it's okay to be gay" near the Olympic Park. Last week, the recently freed members of Pussy Riot were briefly detained and then beaten by uniformed Cossacks in downtown Sochi, where they were shooting a video for their new anti-Putin protest song. And although Putin eased an outright ban on protesters ahead of the Olympics, demonstrations were restricted to remote areas, and authorities carefully selected applicants for rally permits.

"The protest zone was a joke. It didn't exist," says Wallechinsky, who was doing commentary in Sochi for Westwood One radio. "It was some place where nobody would go ... The entire Olympic area was sanitized."

Larger protests would have certainly grabbed headlines in the West, though Maria Lipman of the Carnegie Moscow Center says they likely wouldn't have done much to shift Putin's domestic policies.

"he took a very firm stance: nobody has the right to teach us or preach to us."

"I don't think Putin can be emboldened or not emboldened depending on what the world thinks," says Maria Lipman of the Carnegie Moscow Center. "From very early in his tenure — 10 years ago, 12 years ago — he took a very firm stance: nobody has the right to teach us or preach to us."

All told, the Olympics unfolded about as smoothly as Putin could've hoped for as Russia successfully thwarted disruptions and seized every opportunity to fuel patriotic sentiment; even the highly publicized construction issues and malfunctions were spun by the state-controlled media into an anti-Western narrative.

But as the games entered their final week, they were quickly overshadowed by an outburst of violence in the Ukrainian capital of Kiev, where parliament last week voted to oust president and Kremlin ally Viktor Yanukovych following deadly clashes between police and anti-government protesters. Demonstrations first erupted in November, after Yanukovych announced that he would abandon a deal to strengthen economic ties with the European Union, choosing instead to forge closer ties with Russia. Renewed violence spread across the city last week, forcing Yanukovych to flee Kiev and raising questions about how Russia will respond to the uncertainty its neighbor and former Soviet state now faces.

"This was a man who should have been thrilled."

"It's both economic and cultural, and it's geopolitical," Gorenburg says, adding that Kiev is seen as the cradle of Slavic culture. "I think there are a lot of people in Russia who are still not quite reconciled to Ukraine really being a separate state."

Russia has denounced the coup as the work of radicals and fascists, while criticizing Western interventions, though it has given no indication that it is considering military action. And although Putin has remained quiet on the issue so far, Ukraine cast an unmistakable shadow over last night's closing ceremony.

"One thing that really struck me was the expression on Vladimir Putin's face whenever [television cameras] cut to him," Wallechinsky said in a phone interview shortly after Sunday's ceremony.

"This was a man who should have been thrilled. Russia won the most gold medals, they won the most total medals, the games were well-organized and went smoothly. And this was a man who looked really unhappy at what should have been his crowning achievement."