Ryan Lochte was given a 10-month suspension for his behavior in Rio. (Michael Sohn/Associated Press)

An appellate court in Brazil ruled Friday that the case against Ryan Lochte should be dismissed. The U.S. swimmer had been accused of fabricating a story about getting robbed at gunpoint in Rio de Janeiro during August’s Olympics, causing an international scandal that drew in some of his teammates.

Lochte was charged with a false crime report, which could have resulted in a sentence of one to six months in jail, although he would have been unlikely to serve it. The 12-time Olympic medalist returned to the United States before the Games ended and the charge was filed, but he was given a 10-month suspension by USA Swimming for his behavior in Rio.

According to USA Today, the court concluded that Lochte, who eventually admitted he “over-exaggerated” the story and apologized for his “immature behavior,” did not break Brazilian law. The three-judge panel, in a 2-1 ruling, noted that Rio police, not Lochte, had initiated the investigation and that the story he first told NBC did not meet the standard of a false report.

Prosecutors could still challenge the ruling, and they have 15 days to do so. Lochte’s lawyers have been pressing for a dismissal of the case, but a lower court had ruled 2-1 to uphold the charge.

“We are pleased that the court has finally dismissed the criminal prosecution against Mr. Lochte, while at the same time, appropriately recognizing that he committed no crime,” Jeff Ostrow, a Florida-based attorney for Lochte, told USA Today. “It has been a long year, but in the end, justice prevailed.”

Lochte had said that he and three other U.S. swimmers, Jimmy Feigen, Gunnar Bentz and Jack Conger, were on their way back to the Olympic Village from a party when their car was pulled over by gun-toting robbers pretending to be police officers. Citing surveillance video footage and eyewitness accounts, Brazilian authorities claimed that Lochte and his teammates vandalized and urinated on a gas station, after which security guards pointed a gun at them and demanded recompense before they left.

Lochte subsequently said that he “definitely had too much to drink” that night, adding that he was still intoxicated when he provided false details to NBC’s Billy Bush the day after the incident. While he was able to leave Brazil quickly, his three teammates were detained, with Feigen agreeing to pay a fine of nearly $11,000 to expedite his departure.

In the wake of the firestorm, which overshadowed the second week of the Olympics, Lochte lost several sponsors. His suspension left him unable to compete at last month’s U.S. nationals, making him ineligible for the world championships later this month in Budapest.

The notoriety Lochte earned from the incident resurfaced at the ESPY awards this week, when host Peyton Manning joked that last year’s host, professional wrestler John Cena, “is an athlete the same way that Ryan Lochte is a reliable witness.”

Lochte’s suspension ended on July 1, and he had planned on competing this week at the Los Angeles Invitational, but he pulled out, citing the birth last month of his first child. The 32-year-old has said he wants to return to top-level competitions, though, and represent the U.S. at the 2020 Olympics in Tokyo.