Novak Djokovic left for the airport not long after the court ruling was given. | Reuters

Novak Djokovic flew out of Australia on Sunday after a court upheld the government's decision to cancel his visa. The unanimous ruling by a three-judge Federal Court bench dealt a final blow to Djokovic's hopes of chasing a record 21st Grand Slam win at the Australian Open that starts on Monday.

The Serbian player went to the airport in Melbourne just hours later. Federal agents escorted him and his team from the business lounge to the gate, where he boarded an Emirates flight bound for Dubai. The flight took off shortly before 11pm. (12.00 GMT).

Djokovic said after the ruling that he was extremely disappointed as it meant he could not take part in the tournament. "I respect the court’s ruling and I will cooperate with the relevant authorities in relation to my departure from the country," he said in a statement, and wished the tournament well.

The controversy has become a political touchstone for Prime Minister Scott Morrison as he prepares for an election due by May. His government has faced criticism for its handling of Djokovic's visa application.

Morrison welcomed the court's ruling, saying the decision will help "keep our borders strong and keep Australians safe" "It's now time to get on with the Australian Open and get back to enjoying tennis over the summer."

Serbia's prime minister, Ana Brnabic, said on Sunday: "I think that the court decision is scandalous. I am disappointed. I think it demonstrates how the rule of law is functioning or better to say not functioning in some other countries."