Athlete will be able to finally return to the US where teammates have faced a hostile reception from media.

US Olympic swimmer Jimmy Feigen agreed to make a donation in return for having his passport returnedGetty

US Olympic swimmer Jimmy Feigen has agreed to pay almost $11,000 to a Brazilian charity over his involvement in false claims he was victim of an armed robbery at the Rio Games.

The gold medal-winner will have his passport returned as part of the agreement with a judge and Brazil's prosecuting ministry.

"After a long deliberation, this agreement was reached ... he will donate 35,000 real [£8,200, $10,800] to an institute, and with that the case is resolved," Feigen's lawyer Breno Melaragno was quoted as saying by NBC News.

"After this donation is done, his passport will be given back to him and he will be free to return home."

The money will reportedly be donated to the Reaction Institute, a non-profit organisation set up by Brazilian Olympian medallist Flavio Canto which helps youngsters from deprived backgrounds get involved in judo.

It comes after Feigen and three of his fellow Gold medallist teammates – Ryan Lochte, Gunnar Bentz and Jack Conger – made international headlines after Lochte claimed the group had been held up at gun point on Sunday (14 August) after a party. Lochte said the alleged perpetrators were disguised as police officers and took their money.

CCTV later showed the story had been invented after the athletes became involved in a confrontation during which a petrol station was vandalised. "No robbery was committed against these athletes. They were not victims of the crimes they claimed," Rio's civil police head Fernando Veloso had said.

He claimed one or more of the athletes had damaged a toilet at the petrol station and offered to pay for repairs. They handed over money and left when security guards arrived, one of whom Veloso said had justifiably drawn his gun after the erratic behaviour of one of the swimmers.

US Olympic swimmers Jack Conger and Gunnar Bentz check in at the international airport to board a flight back to home. after spending the day being interrogated by police in Rio de JaneiroUeslei Marcelino/Reuters

The US Olympic Committee (USOC) later confirmed the version of events and apologised, saying the behaviour of the athletes "is not acceptable, nor does it represent the values of Team USA or the conduct of the vast majority of its members".

A judge issued search and seizure warrants for the passports of the four athletes on Wednesday, with police saying they could face charges of false testimony and vandalism.

It emerged Lochte had already flown back to the US while two other members of the group, Bentz and Conger, were taken off a flight in Rio on Thursday night to be questioned by police. The pair denied playing any part in the invented story and were allowed to leave on another US-bound flight.

Feigen, the last of the group left in Rio, is now free to return to the US, where the media has slammed the swimmers' conduct.

The San Francisco Chronicle accused them of not only embarrassing their own country, but "humiliating" the host nation in the process. Lochte came in for strong criticism and was described as harbouring "delusions of machoness."

The New York Post spared no punches, saying Lochte "cried wolf and was called on it," while the Washington Post said he represents a "special category of obnoxious American 'bro'".

US Olympic swimmer Ryan Lochte claimed he was robbed at gunpoint by criminals posing as policeman at the Rio 2016 Olympic gamesGetty