World number one Novak Djokovic had languished in a Melbourne detention centre since Thursday morning after having his Australian visa cancelled over his Covid-19 vaccine status.
But the 34-year-old, who is hoping to defend his Australian Open title and win a record 21st Grand Slam title, won a court appeal on Monday and has been ordered released from detention as the Australian government decides its next steps.
AFP looks at how the drama, which has reverberated around the world, has unfolded:
Tuesday, January 4
-- Djokovic says he is heading to the Australian Open to defend his title after being granted a medical exemption to play.
All participants at the Australian Open, which starts on January 17, need to be vaccinated against Covid-19 or have a medical exemption, assessed by an independent panel of experts.
His participation at the opening Grand Slam of the year at Melbourne Park had been subject of intense speculation for months.
"I'm heading Down Under with an exemption permission. Let's go 2022!" the nine-time Australian Open winner says on Instagram.
Wednesday, January 5
-- Australian Open tournament chief Craig Tiley says 26 players or their support staff from the 3,000 or so travelling had asked for an exemption, but only a few were successful.
"There's been no special favour. There's been no special opportunity granted to Novak," says Tiley.
-- Stephen Parnis, a former Australian Medical Association vice-president, says it sent an "appalling message" to people trying to stop the spread of Covid-19.
"I don't care how good a tennis player he is. If he's refusing to get vaccinated, he shouldn't be allowed in," Parnis says on Twitter.
-- Late Wednesday, Djokovic lands at Melbourne airport.
Thursday, January 6
-- Australia says it has cancelled the entry visa of Djokovic on his arrival in Melbourne after quizzing Djokovic during the early hours.
"I am not vaccinated," Djokovic tells Australian border control, according to a transcript released by the federal court on Monday.
The Serbian ace had repeatedly refused to confirm in public if he had been inoculated.
"Mr Djokovic failed to provide appropriate evidence to meet the entry requirements to Australia, and his visa has been subsequently cancelled," the Australian Border Force says in a statement.
-- Djokovic is moved to an immigration detention centre while his lawyers lodge an appeal.
-- The incident sparks an immediate spat. Serbia President Aleksandar Vucic says he spoke with Djokovic over the phone and told him that "the whole of Serbia is with him and that our authorities are undertaking all measures in order that maltreatment of the world's best tennis player ends as soon as possible".
The player's father Srdjan says his son was "held captive for five hours".
"Jesus was crucified and endured many things but is still alive among us," he says on Orthodox Christmas Eve. "Novak is also crucified... the best sportsman and man in the world. He will endure."
-- However, Djokovic's long-time rival and fellow 20-time major winner Rafael Nadal says: "He made his own decisions and everybody is free to take their own decisions, but then there are some consequences."
Friday, January 7
-- Djokovic thanks fans for their support. "Thank you to people around the world for your continuous support. I can feel it and it is greatly appreciated," he writes on Instagram.
-- Czech doubles player Renata Voracova, who also entered on an exemption as she had recently recovered from Covid, ends up in the same detention facility as Djokovic.
The 38-year-old tells Czech media the centre "is like a prison" with guards on every floor.
Saturday, January 8
-- Djokovic was given a Covid-19 vaccine exemption because he tested positive for the virus on December 16, his lawyers say in a 32-page court filing.
However, it is then claimed that Djokovic was at a young players event in Belgrade the following day without a mask.
The Belgrade tennis federation, in a Facebook post after the December 17 ceremony, reports that Djokovic had handed over cups and awards to the best young players of 2021.
-- His lawyers also claim that he was held at Melbourne airport on his arrival for eight hours, mostly incommunicado.
-- Voracova leaves Australia.
Sunday, January 9
-- Australia's government in court filings says Djokovic is not vaccinated against Covid-19 and his legal battle to stay in the country should be dismissed.
-- Government lawyers reject a separate argument that Djokovic was treated unfairly because he was pressured into letting a border agent take a decision on his visa without giving him extra time to rest and consult his lawyers.
-- Judge Anthony Kelly orders Monday's hearing to go ahead, refusing a government request to adjourn until Wednesday.
Monday, January 10
-- Djokovic's appeal hearing opens, but is repeatedly delayed by glitches as the court's online system crashes due to a surge of worldwide interest.
-- After several delays and arguments made by Djokovic's legal team and Canberra's lawyers the world number one wins a stunning victory over the Australia government.
The judge orders that he "be released immediately and forthwith from immigration detention".
-- The presiding judge overturns the cancellation of the unvaccinated star's visa, ending his detention.
The government concedes that the way it conducted the airport interview was "unreasonable" because the player was not given the chance to reply fully before his visa was torn up.
Had Djokovic been given until 8:30 am to respond as first promised, the judge says, "he could have consulted others and made submissions to the delegate about why his visa should not be cancelled."
-- A government lawyer says Immigration Minister Alex Hawke may decide to use his "personal power of cancellation" to intervene in the case despite the legal victory.