Last updated on .From the section Winter Olympics

Host nation Russia finished on top of the medal table as the 22nd Winter Olympics came to a close in Sochi on Sunday after 17 days of competition.

International Olympic Committee president Thomas Bach officially closed the Games during an extravagant 130-minute ceremony.

South Korea was given the Olympic flag as Pyeongchang hosts the 2018 Games.

Britain's Winter Olympic gold medallists 1924: Men (curling) 1936: Men (ice hockey) 1952: Jeannette Altwegg (figure skating) 1964: Tony Nash & Robin Dixon (two-man bobsleigh) 1976: John Curry (figure skating) 1980: Robin Cousins (figure skating) 1984: Jayne Torvill & Christopher Dean (figure skating) 2002: Women (curling) 2010: Amy Williams (skeleton) 2014: Lizzy Yarnold (skeleton) * Madge Syers won figure skating gold at the 1908 Summer Olympics in London

Britain equalled its best Winter Olympics performance with one gold, one silver and two bronze medals.

The build-up to the Games was overshadowed by concerns over the threat of a terrorist attack and the impact of protests against Russian anti-gay legislation.

But Bach said Russia and the Black Sea resort city of Sochi had "delivered all that it promised" and risen above the concerns to deliver an impressive Olympics.

"These were excellent Games that may lead to the reversal of some criticism of the Russian organisers that preceded the Olympics," he said.

Bach used his speech at the closing ceremony in the Fisht Stadium to emphasise Olympic values.

"By living together under one roof in the Olympic Village you send a powerful message from Sochi to the world, that of a society of peace, tolerance and respect," he said.

"I appeal to everybody implicated in confrontation, oppression and violence to act on this Olympic message of dialogue and peace."

Russian President Vladimir Putin, who watched the ceremony from the stands and made several appearances at the Games to oversee the nation's investment of £600m in elite sport, did not get his wish of a gold medal in the ice hockey.

But victory for the four-man Russian bobsleigh team gave the host nation its 13th gold medal of the Games - and 33 medals in total - to ensure they topped the medal table, emulating Canada's achievement four years ago.

BBC Sport's Sochi 2014 Awards

It marked a stunning turnaround from the 2010 Vancouver Games where Russia won just 15 medals, including three golds, to finish 11th overall - its worst-ever result.

"People kept asking me whether I believed Russia could do as well as Canada did in Vancouver and I didn't believe it," said Russian Alexander Legkov, who won gold in the 50km cross-country.

"Now this is our pride, it's wonderful. What could be better than ending the Olympics with a gold medal and helping Russia top the medal table?"

The Games cost £30bn, making Sochi the most expensive Olympics ever, and featured a record 2,800 athletes from 88 countries, with 12 new events added to attract young audiences.

But there were also six failed drugs tests - five more than in Vancouver - as the most extensive anti-doping programme in Winter Olympics history saw a record 2,453 tests carried out.

The host nation's problem with stray dogs has been well documented and struck a chord with many competing athletes.

Many have adopted dogs, while US ice hockey player David Backes is working on plans to open a shelter back home and bring the strays over.

Organisers made a joke at their own expense in the closing ceremony as dancers formed themselves into four rings and a small clump in a nod to the malfunction in the opening ceremony, when one of the Olympic rings failed to open.

Organisers made a joke of the opening ceremony Olympic ring malfunction

For Britain, Sochi marked a record-equalling Winter Olympics, a tally of four medals matching its haul in the inaugural 1924 Games in Chamonix, France.

In doing so, the 56-strong team surpassed the medal target of three set by UK Sport, which awards funding, to raise hopes of a financial boost ahead of the 2018 Games.

Snowboarder Jenny Jones became the first Briton to win a medal on snow with bronze in the slopestyle before Lizzy Yarnold won gold in the skeleton to emulate Amy Williams's success in 2010.

The women's curlers then won bronze and the men's team silver, skip David Murdoch winning a first medal in his third Games.

Britain's brilliant Sochi medal haul

The total could have been greater still, with the men's four-man bobsleigh team and snowboarder Jamie Nicholls coming close to a podium finish, and short track speed skater Elise Christie suffering the misfortune of three disqualifications.

Britain's athletes now must wait until June to find out whether they will be funded for the next Olympic cycle.

Great Britain chef de mission Mike Hay told BBC Sport: "I am proud of the team's achievements. We have competed to the utmost of our ability.

"I'm delighted with everybody, not just with the medals, but with the number of finals and top-half finishes we have had.

"We have won four medals, which sets a new standard for us. We have come a long way from Vancouver 2010 where we won just the one medal.

"The team has a young profile and I believe we can do even better in Pyeongchang in 2018."

South Korea, with a budget of £7bn for the 2018 Games, will become only the second Asian country to host a Winter Olympics after Japan staged the Games at Sapporo in 1972 and Nagano in 1998.