SOCHI, Russia (AP) -- Flushed with pride after a spectacular showing at the costliest Olympics ever, Russia celebrated 17 days of sport-driven global unity on Sunday night with a farewell show that hands off the Winter Games to their next host, Pyeongchang in South Korea.
Fireworks and a countdown kicked off the closing ceremony in the Fisht Olympic Stadium, packed with spectators who chanted "Ro-ssi-ya! Ro-ssi-ya!" - "Russia! Russia!" -and were in a party mood after the high-security games passed off safely without feared terror attacks.
Giant screens flashed highlights from the 17-day games. With a 3-0 victory over Sweden in the men's hockey final Sunday, Canada claimed the last gold from the 98 medal events. Russian President Vladimir Putin watched the proceedings, smiling as he stood aside Thomas Bach, the president of the International Olympic Committee.
The closing ceremony, a farewell from Russia with love, pageantry and protocol, started at 20:14 local time precisely - a nod to the year that Putin seized upon to remake Russia's image with the Olympics' power to wow and concentrate global attention and massive resources.
Its $51 billion investment - topping even Beijing's estimated $40 billion layout for the 2008 Summer Games - transformed a decaying resort town on the Black Sea into a household name. All-new facilities, unthinkable in the Soviet era of drab shoddiness, showcased how far Russia has come in the two decades since it turned its back on communism. But the Olympic show didn't win over critics of Russia's backsliding on democracy and human rights under Putin and its institutionalized intolerance of gays.
Despite the bumps along the way, Bach is expected to use the closing ceremony to deliver an upbeat verdict on the games, his first as IOC president. One of Sochi's big successes was security. Feared attacks by Islamic militants who had threatened to target the games didn't materialize.
"It's amazing what has happened here," Bach said a few hours before the ceremony. He recalled that Sochi was an "old, Stalinist-style sanatorium city" when he visited for the IOC in the 1990s.
"You entered the room and you were looking at the roof so you would not be hit by something falling down," he said.
As dusk fell Sunday, Russians and international visitors streamed into the stadium for a ceremony that will feature the extinguishing of the Olympic flame. Day and night, the flame became a favorite backdrop for "Sochi selfies," a buzzword born at these games for the fad of athletes and spectators taking DIY souvenir photos of themselves.
Athletes will kiss goodbye to rivals-turned-friends from far off places, savor their games and achievements or rue what might have been. Absent will be five competitors tossed out after they were caught by what was the most extensive anti-doping program in Winter Olympic history, with the IOC conducting a record 2,453 tests.
The crowd will wave goodbye to the games in Sochi's Fisht Stadium, a jewel of the all-new Olympic Park by the Black Sea, looking up at the snowy Caucasus Mountains where skiers, snowboarders and sliders competed. The audience is sure to raise the roof for the Russian team when it parades in.
Russia's athletes topped the Sochi medals table, with a record 13 golds and 33 total. It represented a stunning turnaround from the 2010 Vancouver Games. There, a meagre 3 golds and 15 total for Russia seemed proof of its gradual decline as a winter sports power since Soviet Union collapsed in 1991. Russia's bag of Sochi gold was the biggest-ever haul by a non-Soviet team.
Russia's golden run started with aging star Evgeni Plushenko leading Russia to victory in team figure skating. Putin was on hand for that, one of multiple times when he popped up at venues across the games.
Russia's last gold came Sunday in four-man bobsled. The games' signature moment for home fans was Adelina Sotnikova, cool as ice at 17, becoming Russia's first gold medalist in women's Olympic figure skating.
"The success of the home team is always an important part of the success of the games overall," said Bach.
The last gold from the 98 medal events, a Winter Games record, was in ice hockey, with Canada and Sweden competing for it.
Not all of the headlines out of Sochi were about sport. Organizers faced criticism going in about Russia's strict policies toward gays, though once the games were under way, most every athlete chose not to use the Olympic spotlight to campaign for the cause. And an activist musical group and movement, Pussy Riot, appeared in public and was horsewhipped by Cossack militiamen, drawing international scrutiny.
And during the last days of competition, Sochi competed for attention with violence in Ukraine, Russia's neighbor and considered a vital sphere of influence by the Kremlin.
In an Associated Press interview on Saturday, Bach singled out Ukraine's victory in women's biathlon relay as "really an emotional moment" of the games, praising Ukrainian athletes for staying to compete despite the scores dead in protests back home.
"Mourning on the one hand, but knowing what really is going on in your country, seeing your capital burning, and feeling this responsibility, and then winning the gold medal," he said, "this really stands out for me."