A Russian court ordered the early release of a Jewish teacher whose bribery trial was marred by anti-Semitic statements and whose lengthy prison sentence was criticized by Russian President Vladimir Putin.

The Tver Regional Court last week reduced Ilya Farber’s sentence from seven years to three for accepting bribes and abusing his position while working as a teacher in the village of Moshenka, the FirstNews.ru website reported. He is expected to be freed early next year.

Leading opposition figures in Russia have rallied around Farber’s case, presenting it as a miscarriage of justice and pleading for his release.

The prosecution petitioned the court to reduce Farber’s sentence in September, days after Putin told a television network that the sentence was “egregious.”

Putin made the statement as the Kremlin’s human rights council was looking into the case because of irregularities in the trial and claims that it had been tainted by anti-Semitism.

Farber was arrested in 2011 and convicted that year for accepting $13,000 in bribes paid to him by a contractor who needed Farber’s signature to collect money from the government.

Farber has denied any wrongdoing and claims he was set up.

A higher court scrapped the earlier conviction in 2011 because of irregularities, including the judge’s instruction to the jury to “not to pay attention to the words of the defendant,” and gave Farber a retrial. In the retrial, the higher court sentenced Farber to seven years in jail — two years shy of what the prosecution had sought during the retrial.

Witnesses said they heard the prosecutor ask the jury during the first trial: “Is it possible for a person with the last name Farber to help a village for free?” The statement was interpreted as referring to the fact that Farber is Jewish.