The Beijing Winter Olympics have closed with IOC chief Thomas Bach hailing a smoothly run event and a "safe Games" in the midst of the Covid pandemic, but the gold medals were overshadowed by a doping controversy.

The Games ended on Sunday in the "Bird's Nest" stadium, just as they had when the Chinese capital hosted the 2008 Summer Olympics, in a snowflake-themed closing ceremony attended by President Xi Jinping and a socially-distanced crowd.

As he declared the Games over and handed over to 2026 hosts Milano-Cortina, the International Olympic Committee president Bach hailed an "unforgettable Olympic experience".

Russia's Kamila Valieva was engulfed by a drugs controversy Russia's Kamila Valieva was engulfed by a drugs controversy Photo: AFP / Manan VATSYAYANA

The Games produced bright new stars including China's Californian-born freestyle skier Eileen Gu, who won two gold medals to cement her huge popularity in the host nation.

The future of 15-year-old Russian figure skating prodigy Kamila Valieva is less certain after she failed a drugs test but was allowed to continue competing.

Then, after a week of intense pressure, she fell apart in an error-strewn performance that will go down as one of the saddest in Olympic history.

Chinese organisers will be quick to hail the success of the vast Covid-secure "bubble" that enveloped the Games, with up to 70,000 people sealed off.

Volunteers wave flags during a victory ceremony Volunteers wave flags during a victory ceremony Photo: AFP / Marco BERTORELLO

There was no mass outbreak of Covid at the Games or in the wider Chinese capital, but Bach said: "If we want to finally overcome this pandemic, we must be faster, we must aim higher, we must be stronger -- we must stand together.

"In this Olympic spirit of solidarity, we call on the international community: give equal access to vaccines for everybody around the world."

With tensions rising between Russia and Ukraine, Bach said the athletes had "given peace a chance".

Japan's Yuzuru Hanyu may have said goodbye to the Olympics Japan's Yuzuru Hanyu may have said goodbye to the Olympics Photo: AFP / Anne-Christine POUJOULAT

"May the political leaders around the world be inspired by your example of solidarity and peace," he said.

China and its ruling Communist Party will look back on a soft-power success.

The Global Times, a Chinese nationalist state-run tabloid, said on Monday the Olympics had shown the 'true nature' of China.

"The unexpected global popularity of the Beijing Winter Olympic Games declared the complete failure of the so-called diplomatic boycott, smashed the malicious slander of some Western media, and demonstrated the enduring charm of human resilience and unity," it said.

Sweden's Nils Van Der Poel competes in the men's speed skating Sweden's Nils Van Der Poel competes in the men's speed skating Photo: AFP / WANG Zhao

Echoing that theme, fireworks lit up the night sky at the ceremony, spelling out "ONE WORLD".

Gu, the 18-year-old who was born in California but switched to China in 2019, gave the hosts a significant medal bump, helping them finish third in the medals table with nine golds.

USA's Jessie Diggins celebrates her silver on the podium at the closing ceremony USA's Jessie Diggins celebrates her silver on the podium at the closing ceremony Photo: AFP / Anne-Christine POUJOULAT

That was easily China's best performance at a Winter Games, a place ahead of chief geopolitical rival the United States, who claimed eight golds.

For the second Games in a row, Norway topped the medals table, with 16 golds, mainly thanks to their peerless cross-country skiers. Germany were second on 12.

A new men's figure skating champion emerged in 22-year-old Nathan Chen of the United States, who dethroned two-time Olympic champion Yuzuru Hanyu, in what could be the Japanese legend's final Games appearance.

Shaun White, the American who has defined snowboarding, bowed out after finishing without a medal. The 35-year-old three-time Olympic champion called the sport "the love of my life".

There was bitter disappointment for his fellow American and one of the biggest names of the Games, the alpine skier Mikaela Shiffrin, who also went home empty-handed.

But it was Valieva's story that dominated the Games, catapulting the teenage skater to the forefront of yet another Russian doping controversy to mar an Olympics.

After becoming the first woman in history to land a quadruple jump in Olympic competition to help Russia win the team event, it was revealed Valieva had tested positive for trimetazidine, a drug used to treat angina but which is banned for athletes because it can boost endurance.

To fury from the US team and others, the Court of Arbitration for Sport allowed her to continue competing at the Games, citing her young age, though without clearing her of doping.

In the final, Valieva fell several times, to audible gasps from the crowd, and was given a cold reception from her coach Eteri Tutberidze as she left the rink.

Bach called that reaction "chilling" and ordered the young skater's coaches and advisors be investigated.

Valieva's doping case looks certain to drag on for months.

For the first time in Olympic history, the IOC ruled that the skating team medals cannot be awarded until her case is settled.

Ice skating's governing body meanwhile said it would consider a proposal to raise the minimum competition age to 17.

While a Covid outbreak never materialised, some athletes did have the Olympics ruined by the virus and the pandemic was never far away -- Russia and Canada's women ice hockey teams played each other wearing medical masks after the results of their PCR tests failed to arrive in time.

China warned in the fraught lead-up that foreign athletes criticising the authorities could face consequences, but any protests against the hosts were extremely muted.