ANALYSIS: This week's Papua New Guinea Supreme Court ruling has underlined how Australia's adherence to human rights norms is regressing and causing problems in the Pacific.
PNG's highest court ruled on Tuesday that the detention of hundreds of people against their will on Manus Island, on Australia's behalf, is illegal.
About 850 men who had sought asylum in Australia since 2012 had been transferred to Manus by Australia under its policy of offshore processing of asylum seekers.
The ruling came after the United Nations' recent annual review of Australia's human rights record found that the country had gone backwards in meeting its rights obligations.
And, in recent days, the president of the Australian Human Rights Commission described how the country's elected representatives had shown alarmingly poor leadership on human rights issues.
A Pacific solution
In 2012, Australia's then prime minister Julia Gillard struck a deal with her PNG counterpart, Peter O'Neill, to reopen the Manus processing centre. It was carried on by three successive prime ministers in Canberra.
The deal was billed as ensuring none of the asylum seekers would end up in Australia.
It also allowed PNG's O'Neill-led government to leverage greater control over Australia's $US370-million aid programme in PNG.
However, right from the start, human rights defenders voiced opposition to the plan for indefinite detention of people in what they said would be inhumane conditions.
The United Nations' refugee agency objected to Australia's arrangements and refused to participate in the processing centre operations.
In the interim, hundreds of men detained on Manus - from countries such as Iran, Afghanistan and Sri Lanka - have lived in poor living conditions, surrounded by heavy-handed security, and with great uncertainty about their future.
Acts of self-harm have become common, while at points the tension among the compounds has boiled over, most notably in early 2014 when a riot among detainees resulted in the murder of an Iranian by guards.
This week, a five-judge bench of PNG's Supreme Court ordered the PNG and Australian governments to immediately take steps to end the detention of the 850 asylum seekers and refugees in the centre.
In the wake of the ruling, Mr O'Neill announced that the Manus centre would be closed.
Australian immigration minister Peter Dutton said his government was looking for places to move the asylum seekers, including to another Australian-run processing centre on Nauru, but insisted they would not go to Australia.
An Australian human rights lawyer, Julian Burnside QC, said those detained on Manus should be returned to Australia, "where they first arrived, where they were sent from and where they have a claim for asylum".
"I hope that New Zealand and other countries will condemn Australia for its continued use of Papua New Guinea and Nauru as places to warehouse people who we don't want because they've come here asking for our protection," Mr Burnside said.
The treatment of asylum seekers is hardly better in the Nauru offshore processing centre.
The tiny cash-strapped nation relies on the centre for much of its income but, much like on Manus, the asylum seekers on Nauru suffer from mental disintegration and physical abuse.
Allegations of sexual and physical assaults on children detained on Nauru have recently been brought to the attention of Australia's lawmakers but little has changed.
The situation on Nauru has grown so desperate that, this week, a refugee set himself on fire, and four other asylum seekers attempted self-harm, to coincide with a visit from three Canberra-based staff of the UN High Commission for Refugees.
Iranian Kurdish journalist Behrouz Boochani, who is detained on Manus, said Australia "must close their Guantanamo" where he and other detainees had suffered torture and humiliation.
He referred to the Manus offshore centre as a prison, but said he and the other detainees were celebrating the ruling, which appeared to pave the way for them to be able to leave the island.
"They wanted to break our personality and take our humanity," said Mr Boochani.
"They treat us like animals and criminals. I wonder how a western country like Australia can make a prison under a systematic torture."
Rule of law undermined
Having entered into asylum seeker deals with the governments of PNG and Nauru, Canberra has lost much of its traction to encourage good governance in those countries.
PNG's prime minister Peter O'Neill is currently implicated in a major fraud case, over which the two previous PNG prime ministers have called for him to stand down.
However despite arrests of the prime minister's lawyer, the attorney-general and a Supreme Court judge, efforts by fraud squad detectives to arrest Mr O'Neill have been obstructed by his lawyers for two years.
The issue has now divided PNG's police force, and further eroded the rule of law in the country.
PNG's small parliamentary opposition claims that government MPs are reluctant to withdraw their support for Mr O'Neill over the issue, lest they lose access to funds for their constituencies.
Similarly across in Nauru, the Baron Waqa-led government is showing signs that it places itself above the law.
It has meddled with the judiciary and suspended five opposition MPs from parliament, including having two of the MPs' passports sized on spurious claims that they organised a protest last year.
Access to Nauru is also heavily restricted, with media representatives required to pay $US5000 as a non-refundable visa application fee, amid sensitivity about criticism of the treatment of Australia's asylum seekers.
In this and other ways, Canberra has gone to new depths to be able to secure its borders.
The UN Special Rapporteur on the Human Rights of Migrants last year postponed a visit to Australia, citing a lack of government co-operation to access detention centres.
Australia's record on human rights has regressed significantly in recent years, according to Australian Human Rights Commission president Gillian Triggs.
Mrs Triggs was the subject of a sustained public attack by the Tony Abbott-led government last year over her organisation's 'Forgotten Children' report, which found children detained on Nauru suffered from extreme levels of distress.
Engaging with Canberra over the asylum seeker policy had been frustrating for Mrs Triggs, who described how senior political figures lacked any understanding about international law.
Following this week's PNG court ruling, Mrs Triggs reiterated that conditions at the detention centres on both Manus and Nauru were "dangerous and unsustainable for legal and ethical reasons".
However she suggested Australian government ministers no longer thought in terms of human rights.
The ruling Liberal party's offshore processing policy is mainly supported by the opposition Labor party.