A Brazilian court dismissed its case against U.S. Olympic swimmer Ryan Lochte on Thursday, less than a year after Lochte was charged with falsely reporting a crime to authorities—an offense that carries up to 18 months in prison. While competing in the 2016 Rio Olympics, Lochte alleged that he and three of his teammates had been robbed at gunpoint at a Shell gas station after attending a party celebrating the end of the swimming competition. Brazilian officials later claimed that Lochte and his teammates had vandalized the station’s restroom while intoxicated, and security guards were simply demanding payment for the damages.

Lochte’s claims were quickly called into question after surveillance footage showed a less severe altercation with security officials. Three days after the incident, a Brazilian judge ordered the swimmers to remain in Rio for questioning, citing inconsistencies in their testimonies. In her filing, the judge claimed that surveillance footage from the Olympic Village showed the swimmers joking with one another after returning from the gas station. One of the swimmers, Jimmy Feigen, ultimately paid a $10,800 fine in order to leave the country, but Lochte had already departed before police had an opportunity to question him.

In an interview with NBC’s Matt Lauer, Lochte apologized to the people of Brazil for his “immature, intoxicated behavior.” “I know what I did was wrong,” he said. “And I know I learned my lesson.” He added that he had “over-exaggerated” his account and omitted certain details.

In the wake of Lochte’s apology, a USA Today investigation seemed to restore some credibility to his claims. The report found no evidence that the swimmers had vandalized the bathroom—only that Lochte had knocked a poster off a wall, which he later paid $33 for. Nevertheless, the damage to Lochte’s public image had been done. The swimmer lost a number of his sponsors, including Speedo and Ralph Lauren, and was suspended from the U.S. national swim team for 10 months. Lochte was also required to forfeit $100,000 in bonuses.

In the months following the scandal, Lochte’s fortune seemed to improve. He picked up new sponsors, landed a spot on Dancing with the Stars, and welcomed his first child with his fiancé. He is currently training for the 2020 Olympics and his U.S. national team suspension has been lifted. On Thursday, an appellate court in Brazil concluded that Lochte had not broken the law last summer because the investigation was initiated by Rio police, not the swimmer himself. With its ruling, the court overturned an earlier decision from a three-judge panel in a lower court, which opted to pursue the charges.

While Lochte has yet to comment on the court’s decision, his attorney, Jeff Ostrow, spoke to USA Today Sports on Friday. “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,” Ostrow said. “It has been a long year,” he added, “but in the end, justice prevailed.”