An Austrian appeals court has ruled that UK historian David Irving - jailed for denying the Holocaust - should be released on probation.
David Irving says he has changed his views on the Holocaust
Irving is now being held in police detention and will be deported to the UK on Thursday, officials said.
Irving was convicted in February in a case that sparked international debate about the limits of freedom of speech.
In 1989 he spoke in Austria denying the existence of gas chambers at Auschwitz, though he later said he was "mistaken".
The appeals court in Vienna had heard calls for both a reduction and increase in his sentence.
Irving on Wednesday welcomed his release and said he was "fit and well".
The 68-year-old said he would urge an academic boycott of historians from Germany and Austria until the nations stopped jailing historians.
"I was put in prison for three years for expressing an opinion 17 years ago," he said.
The BBC's Kerry Skyring in Vienna said the presiding judge converted the remaining two years of Irving's jail term to a provisional sentence, upholding his appeal.
Speaking after the ruling, his lawyer, Herbert Schaller, said: "He is free, and he can leave, and he will leave."
The historian is now waiting for the necessary paperwork to be completed before he can leave a police detention facility in Vienna for the UK, officials said.
Irving's partner, Bente Hogh, told the Associated Press news agency: "He sounded like he was in good form. He's obviously very pleased to be free."
Both the prosecution and defence had challenged the length of the sentence. The crime carries a prison term of up to 10 years.
The 1992 law targets "whoever denies, grossly plays down, approves or tries to excuse the National Socialist genocide".
Irving's release on probation has dismayed Jewish groups.
Lord Janner, vice-president of the World Jewish Congress and president of the Commonwealth Jewish Council, said: "I am sorry that he did not serve out his full term, and I hope he will remain in Austria and not return to the United Kingdom, where he will not be welcome."
Asked about Irving's comments about historians being put in prison, Lord Janner said: "I do not believe that he was put in prison because he was a historian. And historians should be treated in the same way as anyone else."
Irving was arrested in November last year on a motorway in southern Austria. He was visiting to give a lecture to a far-right student fraternity.
The conviction had sparked intense debate, with supporters saying it was fully justified but opponents arguing it undermined the right of freedom of speech.
At the initial trial, Irving had said it was "ridiculous" he was being tried for expressing an opinion and that he had changed his views on the Holocaust.