AJL20 now faces the prospect of being forced back into detention.
The lawyer for AJL20, Alison Battisson, described the outcome as “incredibly disappointing”.
“It is incredibly worrying. What this means is his liberty is in jeopardy," she told SBS News.
The man at the centre of the case is a 29-year-old refugee from Syria who came to Australia as a child and had previously been detained for six years.
In 2014, AJL20 had his visa cancelled on "character" grounds under section 501 of the Migration Act, making him an "unlawful non-citizen" in Australia.
The High Court's latest ruling was supported by four out of seven justices - including chief justice Susan Kiefel, Stephen Gageler, Patrick Keane and Simon Steward.
Their judgement says the federal court had “conflated questions of constitutional validity” with questions of “statutory interpretation”, and that this was contrary to the “clear course of authority”.
It also says the Federal Court decision had misinterpreted questions around the purpose of the Migration Act, which the ruling said validly authorises and requires the detention of an unlawful non-citizen.
The dissenting judgements - from Justices Michelle Gordon, Jacqueline Gleeson and James Edelman - opposed the High Court’s majority ruling and remained in support of AJL20's release.
Justice Edelman stated that AJL20 was “entitled to the remedy of habeas corpus for so long as the government persisted with the purpose of removing him.”
The dissenting justices also further outlined the need for the habeas corpus principle to be available towards “remedying unlawful detention”.
“Habeas is not only part of Australian law but an essential form of relief for unlawful executive detention,” the justices wrote.
According to the High Court, the Commonwealth conceded that AJL20 had not been removed from Australia “as soon as reasonably practicable”.
It was this failure to meet so-called "refoulement obligations" that sparked the initial Federal Court decision to order AJL20’s release.
Ms Battisson said that, while the long-term implications of the High Court ruling remained unclear, the decision had undermined expectations around the case.
Human rights advocates were initially hopeful the Federal Court ruling would result in the release of other refugees who had languished in immigration detention for years.
“It’s very unfortunate that there was a chance here to maintain a decision of Australia being more humane,” Ms Battisson said.
"The High Court had a chance to side step decades of unfortunate human rights abuses in Australia and certain members chose not to - it is as simple as that."
In a statement, the Department of Home Affairs said it welcomed the High Court’s decision.
AJL20 has also been asked to pay the government's legal costs - but Ms Battisson said this was unlikely due to his extensive time in detention and lack of access to working rights.
In May, the federal government legislated new laws to ensure detainees were not forcibly removed in breach of Australia’s international obligations. This was in part in response to the AJL20 case.