Papua New Guinea's National Court has freed a Manus Island asylum seeker after a year in prison and ordered he be given residency.
Helal Uddin was arrested for returning to Manus following his deportation to Bangladesh.
In 2013, he was sent by Australian authorities to PNG's northermost island to be detained with about 1300 other men for sailing to Australia to seek asylum.
About 220 of them remain in PNG where all wish to depart whereas Mr Uddin has gone to extraordinary lengths to stay.
After the PNG Supreme Court ruled in 2016 that detention of the men sent to Manus was illegal, Mr Uddin met and married a Manusian woman with whom he had a son.
BuzzFeed reported he opened a canteen on the island and was given the nickname 'Spicy' after his food.
But as he was not given refugee status through PNG's dubious determination process, Mr Uddin was arrested in March 2018 and deported.
Determined to return to his family, he undertook another dangerous sea voyage but this time to Indonesia from where crossed back into PNG without a passport in November the same year.
After four months on Manus, he was arrested again and sent to Bomana prison in PNG's capital Port Moresby.
Last week, Justice David Cannings ordered Mr Uddin be given an entry permit that entitles him to three years of residency.
According to The National the judge found Mr Uddin would continue to be treated harshly and deported by PNG's immigration authority if it was not restrained.
Sufficient regard was not given to Mr Uddin being forcibly transferred from Australia to PNG and being unlawfully detained, Justice Cannings said.
"He has not being given the right to be heard on the question of whether he ought to be deported, nor has he been accorded the opportunity to say why he wished to remain in PNG," Justice Cannings reportedly said.