An appellate court in Brazil has dismissed a criminal case against U.S. swimmer Ryan Lochte, concluding that Lochte did not break the law in exaggerating the details of an incident at a gas station during the Rio Olympics in August.

Lochte had been charged with falsely communicating a crime to authorities after he gave an interview to NBC in which he said he and three other members of the U.S. swim team had been stopped and robbed at gunpoint as the cab they were in tried to pull away from the service station. Lochte, Gunnar Bentz, Jack Conger and Jimmy Feigen had been out celebrating after the conclusion of the swimming competition at the Rio Games.

The swimmers, who were returning to the Olympic Village from a party, stopped at the Shell gas station to use the restroom.

Days later, Rio police held a news conference and said the athletes had vandalized the restroom, breaking a soap dispenser and mirror, as well as destroying a poster outside the bathroom. Police concluded that the swimmers had lied and there had been no crime committed against them, prompting outrage against Lochte in media accounts around the world.

Feigen was subsequently detained by police and agreed to pay a fine so that he could leave Brazil, but Lochte, who already had departed, stood by his story. His lawyers in the U.S. and Brazil moved to have the case dismissed, but a three-judge panel in a lower court ruled 2-1 that the charge was legitimate.

An appeals court on Thursday reversed that decision, 2-1, ruling that Brazilian law was not broken because Rio police had initiated the investigation, not Lochte. Whatever Lochte said in the interview with NBC did not constitute a false report, the court concluded. The decision has not yet been published and prosecutors have 15 days to decide whether they will challenge the ruling.

“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. It has been a long year, but in the end, justice prevailed,” said Jeff Ostrow, Lochte’s Florida-based attorney, in a statement to USA TODAY Sports on Friday.

Lochte was pilloried for days and lost sponsors after Rio police asserted his story was a fabrication – infamously claiming one of the assailants put a gun to his forehead -- but a subsequent investigation by USA TODAY Sports found that, despite the embellishment, the framework of Lochte’s story was true.

Video surveillance and witness accounts showed Lochte and his teammates had been detained by armed security guards, who drew their weapons and ordered the swimmers to pay money for alleged damage at the gas station. The USA TODAY investigation also found no evidence that the men had vandalized a bathroom at the gas station that night, as authorities had alleged.

The only damage caused by the swimmers at the gas station was the poster that Lochte knocked off a wall. Police and Bentz said that the swimmers paid $20 plus 100 Reais, which is about $33, for the poster.

Lochte acknowledged he was intoxicated at the time and apologized for the negative attention he brought on the U.S. swim team, but he said he had never sought to involve police in the matter and had not filed a false report.