Russia has been banned from competing at next year's Winter Olympics in Pyeongchang by the International Olympic Committee.
But Russian athletes who can prove they are clean would be allowed to compete in South Korea under a neutral flag.
It follows an investigation into allegations of state-sponsored doping at the 2014 Games hosted by Russia in Sochi.
"This should draw a line under this damaging episode," the IOC said.
The decision has been widely condemned in Russia, with some politicians urging a boycott of the Games, though other officials have welcomed the chance for 'clean' athletes to take part.
IOC president Thomas Bach and his board - who made the announcement in Lausanne on Tuesday - came to the decision after reading through the findings and recommendations of a 17-month investigation headed up by the former president of Switzerland, Samuel Schmid.
The Russian Olympic Committee (ROC) has been suspended but the IOC said it will invite Russian clean athletes to compete in February under the name 'Olympic Athlete from Russia' (OAR).
Despite repeated Russian denials, the Schmid report has found evidence of "the systemic manipulation of the anti-doping rules and system" which back up previous allegations of government involvement in cheating in the run-up to and during the Winter Olympics almost four years ago.
Bach said: "This was an unprecedented attack on the integrity of the Olympic Games and sport. This should draw a line under this damaging episode and serve as a catalyst for a more effective anti-doping system."
The Games in South Korea, which start on 9 February, will now be without one of the powerhouses of Olympic sport.
- 'Letting clean Russians compete is right'
- Who gets Russia's medals in Pyeongchang?
- McLaren report claims state-sponsored doping
- Russian doping - how we got here
Why is Russia's Olympic Committee banned?
This entire investigation was instigated by whistleblowing doctor Grigory Rodchenkov, who was director of Russia's anti-doping laboratory during Sochi 2014.
He alleged the country ran a systematic programme of doping and claimed he had created substances to enhance athletes' performances and switched urine samples to avoid detection.
The World Anti Doping Agency (Wada) enlisted the services of Canadian law professor and sports lawyer Dr Richard McLaren to look into the allegations.
The McLaren report concluded 1,000 athletes across 30 sports benefitted from the doping programme between 2012 and 2015.
Wada obtained what it said was a Russian laboratory database which it felt corroborated McLaren's conclusions, while re-testing of Russian athletes' samples resulted in a host of retrospective bans and stripping of medals.
Last week, another IOC commission, led by Swiss lawyer Denis Oswald, gave its full backing to evidence provided by Dr Rodchenkov.
What else has the IOC ruled?
As well as the Olympic Committee ban, the IOC has also decided to ban Russia's deputy Prime Minister and former Sports Minister Vitaly Mutko from all future Olympic Games. He is currently the lead organiser for the 2018 World Cup, which is being staged in Russia next summer.
In his report to the IOC executive board, Schmid says Mutko, as the then minister for sport, "had the ultimate administrative responsibility for the acts perpetrated at the time".
Responding to the report, Fifa said the IOC ruling had "no impact" on preparations for the World Cup.
Football's world governing body added that it "continues to take every measure at its competitions to ensure football remains free from doping" and every player will be tested next summer and "the analysis of all doping samples will be carried out at Wada laboratories outside Russia".
- No accreditation for any official from the Russian ministry of sport for the Olympic Winter Games Pyeongchang 2018
- Former Deputy sports minister, Yuri Nagornykh, is excluded from any participation in all future Olympic Games
- Dmitry Chernyshenko, the former CEO of the organising committee Sochi 2014, is withdrawn from the Co-ordination Commission Beijing 2022
- ROC President Alexander Zhukov is suspended as an IOC member, given that his membership is linked to his position as ROC president
- The ROC is fined 15 million dollars (£11.2 million) to reimburse the costs of the investigations and to contribute to the establishment of the Independent Testing Authority (ITA)
- If Russia "respects and implements" what the IOC has called for, the sanctions may be lifted in time for the closing ceremony.
How can clean Russian athletes get to Pyeongchang?
The IOC will allow athletes from Russia to compete individually or as part of a team in South Korea, providing they wear an OAR uniform. The Olympic Anthem will be played in any ceremony.
A specialist panel appointed by the IOC will decide whether an athlete can compete by following these rules:
- Athletes must have qualified according to the qualification standards of their respective sport
- Athletes must not have been disqualified or declared ineligible for any violation of anti-doping rules
- Athletes must have undergone all the pre-Games targeted tests recommended by the Pre-Games Testing Task Force
- Athletes must have undergone any other testing requirements specified by the panel to ensure a level playing field
Action taken so far
- A total of 25 Russians have so far been banned from the Olympics for life on the recommendation of the IOC commission
- The first part of the McLaren report was published in July 2016, when Wada called on the IOC to ban Russia from the Rio Olympics
- The IOC decided against imposing a blanket ban, instead asking individual sporting federations to rule on their participation
- In total, 271 Russians competed in Rio
- Russia was banned from the Paralympics and remains banned from the 2018 Winter Paralympics.
Wada has not called again for the IOC to ban Russia, but recently declared that the country remains 'non-compliant' with its code.
The IPC will make public its decision on the potential participation of Russian athletes at the 2018 Winter Paralympics in London on 22 December.
How has Russia reacted?
President of the ROC, Alexander Zhukov, said there was positive and negative news from the IOC's decision.
He welcomed the invitation for clean athletes to compete in South Korea but does not agree with the ruling that they must compete under a neutral flag.
"If, as proposed, the temporary restrictions are lifted on the last day, then on the last day Russian athletes will compete under their flag with all the athletes from the rest of the world," he told reporters in Lausanne.
He said a final decision on participation is still to be made.
Russian politicians and athletes were united in their condemnation of the IOC decision.
The deputy chairman of Russian parliament's defence committee, Frants Klintsevich, said Russian athletes should not take part in the Olympics in 2018 if they are not allowed to compete under the national flag.
"I don't know what Russia's decision will be in the end, but in my view, a great power can't go 'incognito' to the Olympics," state-owned RIA Novosti news agency reported him saying.
Igor Morozov, another politician said "hybrid war" had been declared on Russia by the IOC decision.
The head of Russia's speed-skating body Alexei Kravtsov said it should be down to the athletes themselves.
"My opinion is that every athlete should decide for themselves whether to take part under a neutral flag or not," R-Sport reported. "But there is an admittance procedure, and that in itself is humiliating."
Russian bobsleigh federation president Alexander Zubkov said on Tuesday he was "shocked" by the decision.
Zubkov was stripped last month of the two gold medals he won at the 2014 Sochi Games and banned from the Olympics for life over alleged doping violations.
Russian state broadcaster VGTRK has said it will not broadcast the winter Olympic games if the Russian team is not participating.
John Jackson, who led Great Britain's men's bobsleigh team in Sochi in 2014, and could now be awarded a bronze medal because of Russian doping bans thanked the IOC for the ruling.
"I believe it is the correct decision to allow the clean athletes of Russia to compete under a neutral flag," he said.
British sports minister Tracey Crouch tweeted that she was "pleased" with the announcement.
"We believe that this decision goes a long way towards protecting the interests of clean athletes," said Wada vice-president Linda Hofstad Helleland.
Jim Walden, a lawyer representing whistleblower Rodchenkov, said the decision "sends a powerful message that the IOC will not tolerate state-sponsored cheating by any nation".
"Dr Rodchenkov personally agrees with the IOC's determination that innocent athletes should compete as neutrals," he added.
What could a Winter Olympics look like without Russia?
The Olympics ban for Russia, who had finished top of the Sochi 2014 medal table, could potentially leave opportunities for gold, silver and bronze open to several other nations.
It is not yet clear how many Russian athletes, if any, will seek to compete under a neutral flag.
Other athletes are considering appeals against their doping bans.
Russia were among the favourites for gold in men's ice hockey following the National Hockey League's decision to withdraw its players from Pyeongchang.
At the last six Winter Games, Russian figure skaters won 14 of the 26 gold medals available and occupied 26 of the 75 podium places.
'Some concessions, but still dark day for Russia' - analysis
BBC sports editor Dan Roan
The punishment is unprecedented in Olympic history. This is a proud sporting superpower that uses such events to promote its image to the world. Not this time.
The hosts of next year's World Cup have just become an international pariah, with the life ban given to deputy prime minister and head of Russia 2018 - Vitaly Mutko - hugely embarrassing for Fifa - an IOC member federation.
Many will say the IOC should have done this 18 months ago before the Rio Olympics, and that both they and WADA should have acted more decisively years ago when reports of Russian cheating first emerged. And could the IOC have been tougher, given the scale of the cheating and the damage done to clean athletes?
The fact that those athletes who meet the criteria and can take part will be called 'Olympic Athletes from Russia' seems a concession to the country. Why not just 'Neutral Athletes'? President Bach also suggested the Russian flag may be flown at the closing ceremony in South Korea.
Yet this is still a dark day for Russian sport and President Vladimir Putin is now understood to be considering whether to boycott Pyeongchang 2018 altogether and forbid any Russian athletes to compete.