(MOSCOW) — A Moscow court on Wednesday will rule whether to uphold the release of an American man who was freed from a Russian jail in March after spending almost two years in detention while on trial over a cleaning product he bought online. Gaylen Grandstaff, a 52-year-old English teacher from Texas, was arrested in July 2017 and taken from his home in Moscow where he lived with his wife, Anna, after police charged him with drug smuggling over a metal solvent cleaner. For 608 days he was kept in pretrial detention, swallowed into the Russian justice system, where trials are skewed toward conviction and defendants are effectively presumed guilty.Grandstaff became one of the very few Americans to spend significant time inside Russian jails. He was kept in grim conditions, harassed, denied medical attention and attacked by inmates. Isolated and forbidden from writing to his wife in English, he turned to illustrating his prison life for her by drawing himself as a cartoon bear enduring his experiences. The charges against him carried a potential maximum sentence of 20 years in prison.ABC News chronicled Grandstaff’s ordeal in a short film earlier this year, detailing his mistreatment in prison and finding signs that police were manufacturing parts of the case against him.Only 0.43% of criminal trials in Russia end in acquittal in 2018, according to Russian legal rights group Zona Prava, and Grandstaff’s case appeared hopeless. But in March he was unexpectedly released after a judge abruptly acknowledged problems with the prosecution’s case.Grandstaff credited his release to his strong defense and also to the news media, including ABC News, which had attended hearings for months and submitted questions to authorities.That was not, however, the end of the story and there is still a risk that Grandstaff’s ordeal could begin again. Prosecutors appealed the decision and now, months later, Moscow’s City Court will consider it on Wednesday. If the judge accepts the appeal, Grandstaff could be returned to jail. The trial against him would recommence, meaning he could potentially face years more in prison if convicted.The appeal by prosecutors is routine, but there is still a risk that Grandstaff could lose and be sent back to jail.Grandstaff’s troubles began when he ordered the solvent from the Chinese site, Ali-Express. The cleaner turned out to contain gamma-butyrolactone, or GBL, an industrial solvent that can be used as a party drug, which is banned in Russia and many other countries as a narcotic. It is also sometimes used as a muscle-growth stimulant in bodybuilding.Grandstaff, who suffers from Crohn’s disease, said he had been upsold the cleaner while buying medicine for his illness on the site and had had no way of knowing it contained GBL.Police, however charged him as a large-scale drug smuggler, an exceptionally serious charge with a possible maximum prison sentence of 20 years.Police accused Grandstaff of buying the cleaning substance to use for bodybuilding. But there were multiple signs of problems with the case, as they sought to portray Grandstaff as a fitness fanatic. A friend of Grandstaff who was called as a witness told ABC News that her testimony had been distorted to make it suggest Grandstaff was a power lifter. Police alleged the peptides Grandstaff had bought for his Crohn’s disease could be used as muscle-builders, but refused to identify what they might be. They even summoned an unrelated bodybuilder as an expert witness, who then told the court he was “not an expert.”Ultimately, even if Grandstaff had known what he was buying, the charge brought against him was excessively severe, experts said, given police accused him of intending to use it for personal fitness.In March, the judge overseeing the case at Moscow’s Soltnsevsky court unexpectedly said the prosecution had failed to gather basic evidence and acknowledged some of the issues Grandstaff’s lawyers had been raising for months. She returned the case to the prosecutor’s office for further investigation and ordered Grandstaff’s release in the courtroom. He walked out of the cage, his friends sobbing.Since his release, Grandstaff has been in limbo.In Russia, when a judge finds prosecutors have insufficient evidence to make a ruling, they can order the case returned to the prosecutor’s office for further investigation, but it means the case against Grandstaff has never been closed. As a result, while he was allowed to live in his apartment with Anna, Grandstaff was forbidden from leaving Russia. At the same time, the possibility that he might be sent back to jail has hung over him.”Instead of it being dismissed, instead of being exonerated, because there’s no evidence to prove their theory — instead of that, in this country, it’s, ‘Go back and find something else,"” Grandstaff told ABC News in April. “Because in this country they don’t think about justice — they think about whoever is accused we convict. It’s a rule that they live by.” Legal experts have said sending cases back to prosecutors usually amounts to a tacit dismissal of a case in a system where full acquittals are so rare. But it’s not certain.The treatment of Grandstaff during his detention, and now following his release, highlights routine injustices in the Russian judicial system, where defendants are allowed to languish in pretrial detention or with cases dragging on with uncertainty for years. The appeal against Grandstaff’s release should have been held months ago by law, according to Grandstaff’s lawyer, Anton Emelchenko, but authorities ignored the deadlines.If the judge upholds the original decision, Grandstaff will remain free and mark a significant step toward being able to finally leave Russia. But that ruling would also theoretically mean the case was simply returned to the prosecutor’s office for further investigation — meaning prosecutors could simply leave the case open again, dragging it out for months more.Grandstaff has been in an immigration gray zone since he was freed — his visa expired during his long detention and migration authorities refuse to issue a new one following his release. It means he is unable to work in Moscow or to exit Russia legally.”This won’t be over until my feet are back on American soil,” Grandstaff told ABC News after his release. Copyright © 2019, ABC Audio. All rights reserved.