PYEONGCHANG, South Korea -- Russia's desperate attempt to get 45 banned athletes -- including several medal favorites -- into the Pyeongchang Olympics failed just hours before Friday's opening ceremony.

The International Olympic Committee had banned Russia because of a massive doping scheme at the 2014 Sochi Games, but gave individual athletes the chance to apply for admission to compete as "Olympic Athletes from Russia." There were 168 Russians who passed the vetting process. Dozens more filed appeals with the Court of Arbitration for Sport.

On Friday, the court upheld the IOC's right to decide who can compete.

Anti-doping officials praised the ruling, which is a heavy blow to Russian medal chances.

Get Breaking News Delivered to Your Inbox

"That's it. The story is over," Russian delegation spokesman Konstantin Vybornov said. Shamil Tarpishchev, a Russian member of the IOC, said the CAS ruling may have been legally correct but he disagreed with the spirit of the ruling.

After two days of hearings, the CAS panel ruled that the commissions which evaluated whether Russian applicants were eligible did not act in a "discriminatory, arbitrary or unfair manner."

CAS secretary general Matthieu Reeb said the IOC process "could not be described as a sanction but rather as an eligibility decision."

Olympic and World Anti-Doping Agency officials welcomed the ruling, with the IOC saying the decision "supports the fight against doping and brings clarity for all athletes."

Among those excluded are six-time gold medalist Viktor Ahn, the short track speedskater whose return to his native South Korea for the Olympics had been eagerly anticipated by local fans.

Also out are cross-country skiing gold medalist Alexander Legkov and skeleton gold medalist Alexander Tretiakov, as well as potential medal contenders in biathlon, luge and bobsled.

Three former NHL players -- Sergei Plotnikov, Anton Belov and Valeri Nichushkin -- also lost appeals, though it was widely considered unlikely they would have played even if they had been successful because the Russian roster is already full.

U.S. Anti-Doping Agency chief executive Travis Tygart said the decision was "a small glimmer of hope in an otherwise dark and sordid affair."

In a telephone interview, WADA president Craig Reedie told The Associated Press: "I am delighted at the decision and the way they expressed it."

The CAS panel has "clearly understood that there was systemic manipulation of the anti-doping process," Reedie said. "Athletes can get their heads down and go. This particular issue is behind us."

The IOC's vetting process was designed to exclude Russian athletes from the games if IOC officials weren't sure they were clean.

The "Olympic Athletes from Russia" will compete in neutral uniforms under the Olympic flag in a decision designed to balance the rights of individual athletes with the need for a strong deterrent to doping.

The Russians wore grey jackets with white scarves at the opening ceremony, and were carrying the Olympic flag.

In Russia, the lower house of Russian parliament - the State Duma - issued a statement deploring the CAS verdict as a reflection of "crude pressure and political struggle in a sports field defying Olympic principles."

The IOC has refused to comment on individual Russian athletes but says it decided who to exclude using a newly obtained Moscow laboratory database with evidence of past doping offenses.

It refused to clear some Russians even after their disqualifications from the 2014 Olympics were lifted by CAS last week.

Stephen Hess, an international sports lawyer based in Colorado Springs, Colorado, said the decision was a victory for the IOC.

"There is no absolute right to get an invitation from the IOC to come to the Olympics," Hess said. "That was within the IOC's discretion. If Russia had an Olympic team, CAS might have said: 'IOC, the Russians can put them on their own team. You can't keep them out.' But Russia doesn't have an Olympic team."

Jim Walden, the lawyer for Russian whistleblower Grigory Rodchenkov, renewed calls for IOC President Thomas Bach to resign "for the sake of the Olympic ideal."

Walden has accused the IOC and CAS of being "complicit in enabling Russian doping" for not implementing strong punishments for Russian athletes, including a blanket ban.

Friday's verdict, he said, is "a small semblance of justice for clean athletes."

Angela Ruggiero of the IOC athletes' commission said the decision sent a message to athletes that "you should be incredibly confident that every athlete, including the Olympic Athletes from Russia, have had to clear incredibly high hurdles to get here."

The barred Russian athletes, however, are still considering their legal options.

Schellenberg Wittmer, from the Swiss law firm representing the Russian athletes, said "our clients consider - rightly so - that the decisions are unfair and harmful ... their Olympic dreams have been shattered."

Other athletes welcomed the end to the saga.

"That is great news," said U.S. women's skeleton athlete Katie Uhlaender, who placed fourth in the Sochi Olympics -- one spot behind bronze medalist Elena Nikitina, who was one of the 45 appealing her ban.

U.S. bobsledder Nick Cunningham said "If dirty athletes are taken out, then clean athletes will prevail. That's what I hope."