RIO DE JANEIRO — A Brazilian judge ordered on Monday the release of a high-ranking IOC member who was arrested during the Rio de Janeiro Games in a ticket-scalping probe.

Judge Fernando Antonio de Almeida accepted a request made by Patrick Hickey’s lawyers to set him free from Rio’s Bangu prison complex, where he has been held since Aug. 19, while his case continues to be investigated. Hickey must remain in Brazil and hand over his passport.

“I don’t see how his freedom could bring any obstacles or present a risk to the public, the criminal investigation or the prosecution,” said Almeida, as he overturned a previous court decision that denied Hickey’s release.

Police have said the 71-year-old Irishman plotted with businessmen to transfer tickets illegally to a vendor who was not authorized to sell them. They want prosecutors to start a judicial process against Hickey for alleged ticket scalping, conspiracy and ambush marketing.

The Olympic Council of Ireland said earlier this month that Hickey decided to “step aside temporarily” as an IOC member and from all his other Olympic positions “until this matter is fully resolved.” Hickey is also president of the OCI, head of the European Olympic Committees and vice president of the Association of National Olympic Committees.

The order for Hickey’s release comes two days after an Irish businessman also investigated in the alleged scheme was let go on bail from the same prison.

The Aug. 5 arrest of Kevin Mallon, head of the British ticket and hospitality provider THG Sports, set the chain of events in motion. He was arrested with hundreds of tickets, including some that were officially allocated to Ireland’s committee, police said. THG was not Ireland’s authorized ticket reseller for the Summer Games.

Authorities estimate the alleged scheme could have netted about $3 million in profits, as tickets were being sold for high fees disguised as hospitality services.

Rio police have already questioned three other OCI executives whose passports, phones and laptops were seized in an Olympic Village raid hours before the games’ closing ceremony. Police say they are considered witnesses.