An Australian judge quashed the cancellation of Novak Djokovic’s visa in a court hearing Monday and said the tennis star should be released from a quarantine hotel in Melbourne.

Federal Circuit court judge Anthony Kelly said the government should pay the world tennis number one’s costs and “take all necessary steps to release the applicant immediately.”

A lawyer acting for the government warned that the immigration department may take steps to cancel Djokovic’s visa again, as suggested in the government’s earlier response.

Djokovic has been confined to a Melbourne hotel that detains refugees since Thursday after border officials overturned a Victoria state vaccine exemption allowing him to play in the Australian Open tournament, where he’s seeking a men’s record 21st Grand Slam victory.

News of the exemption sparked uproar in a country where more than 90% of adults are fully vaccinated and that’s endured some of the toughest restrictions seen in the pandemic, with Melbourne becoming one of the world’s most locked-down cities. Prime Minister Scott Morrison supported the subsequent bid to deport the player after his arrival in Australia, with the saga also serving to highlight the policy and communication mismatch between federal and state officials that’s been a hallmark of Australia’s COVID journey.

Most non-Australian citizens are still barred from entering the country unless they obtain a travel exemption and are fully vaccinated. Djokovic’s lawyers argued on Saturday that he was granted a valid exemption following a positive COVID test on Dec. 16, but the federal government rejected that position.

It said that tournament organisers were told a recent infection wouldn’t allow someone to avoid Australia’s vaccination requirement and receive an entry visa.

Australians who haven’t had at least two doses of vaccine are currently restricted from entering most indoor venues throughout Victoria, in a bid to curb the spread of the highly infectious omicron variant and ease pressure on hospitals. The country reported more than 100,000 new COVID-19 cases for the first time in a single day on Saturday, with cases more than doubling in Victoria to 51,356.

Finance Minister Simon Birmingham said on Channel Nine Sunday that it was “clear” that requirements stipulate that “you need to be double dose vaccinated, if you’re not an Australian citizen, to come into Australia.”

Birmingham said that was “a very clear entry requirement” and “is very clearly communicated” to tournament organisers who issued the medical exemption to Djokovic.

Travel rules vary between countries and are fluid as governments react to outbreaks. China and Hong Kong have followed a COVID Zero approach to keep infections out, with curbs on movement and onerous quarantine requirements, but the strategy is under pressure after omicron seeped through their borders. Singapore abandoned that policy last year, opening travel lanes with several countries to allow in vaccinated travellers without the need to quarantine.

Djokovic has previously won the tournament nine times, and a victory would push him out of a tie with long-time rivals Roger Federer and Rafael Nadal. The tournament will start on Jan. 17.

In a 35-page filing released on Saturday, his lawyers said the world No. 1 had received a document on Jan. 1 from Australia’s Department of Home Affairs affirming the exemption would allow him to enter the country.

“Mr. Djokovic understood that he was entitled to enter Australia and Victoria and to compete in the Australian Tennis Open,” the lawyers wrote.

In its response, the Australian ministry rejected Djokovic’s “so-called ‘medical exemption’” and said “there is no such thing as an assurance of entry by a non-citizen into Australia.” 

The U.K.’s Daily Mail on Saturday published public images of the tennis star at an event with children in Belgrade on Dec. 17. A day earlier, he attended an event in Belgrade at which he was given a personalised Serbian postage stamp, although his posts about the ceremony came the following day. Djokovic also attended an event for his foundation on Dec. 16.

Veteran Czech player Renata Voracova departed Australia late Saturday, the Australian Broadcasting Corp. reported. The doubles specialist had competed in a warm-up tournament for the Australian Open last week.

Her visa was cancelled by the Australian Border Force after she entered the country with the same type of vaccine exemption claimed by Djokovic, the ABC said. A tennis official who wasn’t identified also departed, the ABC said.

Djokovic, 34, said in 2020 that he was personally opposed to vaccines, but later clarified that he was no expert and would make the decision that was right for him.

“I wouldn’t want to be forced to take a vaccine in order to be able to travel,” Djokovic said in 2020, months before the first coronavirus vaccines were available.

He’s known to have tested positive for COVID-19 in 2020, shortly after staging a tennis competition in Belgrade while most of pro sports was still locked down. At least three other players and his wife contracted coronavirus after the event.