The need for laws that would jail people who refuse to co-operate with their deportation from Australia has been questioned after the nation's highest court ruled against an Iranian man's freedom bid.
The High Court on Friday ruled against freeing a detainee who had refused to co-operate with his deportation to Iran, arguing he would be prosecuted for his sexuality despite being found to not be a refugee.
The man, known as ASF17, argued an earlier High Court decision - known as NZYQ - that ruled it was illegal to detain someone indefinitely if there was no real prospect of deportation should be extended to people who deliberately frustrate the federal government's efforts.
Friday's ruling means it's legal for the government to continue his detention and potentially hundreds of detainees in similar circumstances will remain behind bars.
Refugee law expert Mary Anne Kenny said keeping people locked in detention indefinitely harmed their mental health, which made it harder for them to co-operate with their removal.
"(This decision) raises real questions about the need to have this new legislation to threaten people with imprisonment if they don't co-operate with their removal," she told AAP.
"If ongoing detention has a purpose to try to get the person to co-operate with their removal, in practice that's not going to be the case."
ASF17's consistent refusal to co-operate with his deportation to Iran and failure to identify a third country where he would have a right to residency or long-term stay created an impasse because Tehran does not accept involuntary returnees.
But it was possible he could be deported to Iran if he co-operated, which meant the previous NZYQ ruling did not apply if there was a reasonable prospect of him being removed, the High Court determined.
"The short point is that ... continuing detention for a non-punitive purpose that is occurring because of a voluntary decision of the detainee cannot be characterised as penal or punitive," the justices wrote in their legal reasonings.
Immigration Minister Andrew Giles pledged to press ahead with laws that would give the government the power to ban visa classes from countries that refuse to accept deportations.
Refugee groups have called for the government to abandon the bill that would "further damage Australia's human rights record".
Mr Giles defended the need for the laws, saying while the Iranian man would remain in detention, they would patch a gap in the system.
"That next step of putting in place an obligation that someone who no longer has a right to remain in Australia will co-operate with removal to do those basic things like getting the papers," he said.
The Opposition welcomed the High Court ruling but home affairs spokesman James Paterson told Sky News there was still a gap in the immigration system that needed to be addressed.
"There are people who have been found not to be refugees who refuse to co-operate with their own removal and that means they languish now in detention indefinitely ... until they agree to co-operate," he said.
"That is a problem."
The Greens have pledged to vote against the bill, arguing it was racist and deteriorated the rights of diaspora communities in Australia whose family and friends could be blocked from coming into the country.
"Nobody thinks that will work to change the policy of Vladimir Putin or the cruel regime in Iran," Senator David Shoebridge said.
The government needed to have the capacity to deport people who were not refugees and had no right to stay in Australia, Prime Minister Anthony Albanese said.
"They've exhausted their legal processes ... they shouldn't be just allowed to self-nominate in staying here," he said.
Australian authorities have attempted to deport the Iranian man to the conservative nation - where he argued he would face the death penalty for being bisexual - every six months since 2018 when his asylum-seeker visa was refused.