By Amy Tennery

RIO DE JANEIRO (Reuters) - Nine Australian Olympic athletes had their passports returned on Sunday, a team official said, after an accreditation problem at the Rio Games earlier saw them risk missing their flight home.

The nine athletes were briefly detained by police, collectively fined 90,000 reais ($28,000) and had their passports seized after entering the basketball arena without proper accreditation on Friday night.

"We resolved the issue," spokesman Mike Tancred told Reuters Sunday afternoon. "We paid the 90,000 reais and we've been to the courthouse today and [have] spoken to the judge."

The money was deposited in a court account, Tancred said.

"Once they saw the receipt they were happy to resolve the matter with us," he added.

All nine athletes plan to attend tonight's closing ceremony and will be on the Australian team's charter flight that leaves Monday.

The ordeal is the final frustration in Australia's troubled Games, starting with complaints over the standard of their accommodation, theft and a small basement fire. One of their swimmers was mugged a few days before the nine athletes were detained. The team also returns home with a disappointing medal count.

Australian Olympic mission chief Kitty Chiller had previously said she feared it would not be possible to get the passports back in time for the charter flight, due to a public holiday in Rio Monday.

"I'm embarrassed that they had to go through that," she said. "Security was a massive challenge, transport had its problems ... At every level this has been an enormously difficult Games to deliver."

The Australian Olympic Committee is investigating the accreditation problem but Chiller has said the athletes were not to blame.

($1 = 3.2058 Brazilian reais)

(Editing by Mark Bendeich and Jan Harvey)