An Australian court says tennis player Novak Djokovic who has been held in an immigration detention hotel since Thursday will be released and will be able to play in the Australian Open.

Djokovic's passport has been returned to him and the government will be responsible for paying his legal costs, the Federal Circuit Court has ruled.

Counsel for the Commonwealth Christopher Tran told the court that following the decision, the Minister for Immigration and Citizenship may exercise his discretion to cancel Djokovic's visa regardless.

Judge Anthony Kelly said he is "very concerned" about that potential outcome.

He said that if the visa is cancelled by personal exercise of power, Djokovic will not be able to enter Australia for three years.

"The stakes have risen, rather than receded," Judge Kelly said.

Former prime minister Kevin Rudd accused current leader Scott Morrison's centre-right coalition government of bungling the situation.

"Total incompetence! If they seriously didn't want him, why on earth did they give him a visa to fly here?" Rudd said. "This was conceived as one giant distraction strategy when out in the real world people can't get tested."

There was jubilation among the Serbian-Australian community outside the court when the ruling was announced.

News of his release was greeted with noisy celebrations of drum beating and dancing.

Some 100 supporters of the tennis star have been camped outside the court during the hearing. Before this, they spent days outside the hotel where Djokovic was believed to be staying during his detention.

Earlier today the judge hearing Djokovic's legal challenge to the Australian government's decision to revoke his entry visa raised concerns about the Serbian's treatment after he was detained on arrival.

Judge Kelly said it appeared Djokovic had received the required medical exemption from Covid-19 vaccination before he travelled to Melbourne for the Australian Open tennis tournament and presented evidence of that when he landed on Wednesday evening.

"The point that I am somewhat agitated about is what more could this man have done?" Kelly said as Djokovic's lawyers outlined their case challenging the government's decision to revoke his visa.

Djokovic's plight has been closely followed around the world, creating political tensions between Belgrade and Canberra and sparking heated debate over national vaccination mandates.

At risk is the world number one's shot at winning a record 21st Grand Slam at the Australian Open, the year's first major, which starts in Melbourne on 17 January.

Djokovic, 34, has been held in an immigration detention hotel alongside long-term asylum seeker detainees since Thursday. He was permitted to attend his lawyers' chambers for the virtual hearings but has not been seen in public since he arrived in Australia.

His lawyers argue that a recent Covid-19 infection qualified Djokovic for the medical exemption from a requirement for non-Australian citizens entering the country to be double vaccinated.

The Australian government, however, says non-citizens had no right of guaranteed entry to Australia, questioned his claimed exemption and stressed that even if Djokovic wins the court action, it reserved the right to detain him again and remove him from the country.

Exchanges between Kelly and Djokovic's lawyer Nicholas Wood revealed officials made the player switch off his phone from midnight to around 7.42am local time, when the decision to cancel his visa was made.

Officials also reneged on an agreement to give Djokovic until 8.30am to speak to tournament organiser Tennis Australia and lawyers, the judge said. Djokovic was instead woken up by officials at around 6.00am after a brief rest and pressured to respond "because it was better for him if they made the decision right away", according to his lawyer.

Wood said Djokovic had provided evidence to support his claim for exemption both before boarding his flight and on arrival, despite not being required to do so.

'Living like an animal'

A group of supporters gathered outside the Federal Circuit and Family Court today, even though the hearing was held virtually because of the Omicron outbreak in Australia.

Access to the day's hearings was plagued by technical issues that repeatedly crashed the public live-stream.

Many of the supporters outside court, some waving the Serbian flag, held hands and sang as they danced in a circle.

"He has been living like an animal in a human zoo," said one supporter, Petar Nikolic. "What is happening here is unAustralian. It is politics and definitely racist."

In Belgrade, Djokovic's father addressed a small protest in front of Serbia's parliament building on Sunday, also accusing officials of treating his son, and all Serbians, like animals.

However, popular opinion in Australia, where more than 90 percent of the adult population is fully vaccinated, has been largely against the tennis player, particularly in Melbourne, which experienced the world's longest cumulative lockdown.

The country's Covid-19 cases surpassed 1 million on Monday, with more than half of them recorded in the past week, driving up hospitalisation numbers and putting a strain on supply chains.

Tested positive

The saga kicked off when Djokovic posted a photo of himself leaning on his luggage on Instagram last Tuesday, telling the world he was headed to Australia to compete in the Open with a vaccination exemption.

A long-term vocal opponent of mandatory vaccination, Djokovic had never revealed his vaccination status but court documents confirmed he has not been inoculated.

French newspaper L'Equipe published a photograph of Djokovic taken when he was named the daily's Champion of Champions in the days after he said in a court filing he had tested positive for coronavirus, 16 December.

Other photographs published on social media showed him appearing at functions in Serbia on dates soon after that test.

It was not clear if Djokovic knew of his positive test at the time of the events shown in the pictures.

Tennis Australia chief executive Craig Tiley said in his first media interview since the furore began that his organisation had spoken with federal and state officials for months to ensure the safe passage of players.

Czech player Renata Voracova who was detained in the same detention hotel as Djokovic and had her visa revoked after issues with her vaccine exemption, left the country without challenging her status, the Czech Foreign Ministry said.

- Reuters / ABC