A compensation payout of A$70m (£43m; $56m) by the Australian government to asylum seekers detained in Papua New Guinea has been approved by a judge.
Canberra offered the settlement in June after 1,905 men alleged they had suffered harm in detention on PNG's Manus Island. The government called the deal "prudent", but denied wrongdoing.
Australia sends asylum seekers arriving by boat to PNG and Nauru.
The deal is believed to be Australia's largest human rights settlement.
The Supreme Court of Victoria upheld the payout on Wednesday when Justice Cameron Macauley said he was satisfied that A$70m was an appropriate sum.
More than 1,300 of the now 1,923 people who are part of the class action have registered for the settlement. The class action represents the majority of asylum seekers and refugees detained on Manus Island since 2012.
The lawsuit alleged that detainees had been housed in inhumane conditions below Australian standards, given inadequate medical treatment and exposed to systemic abuse and violence.
It also claimed their detention was illegal, pointing to a decision by PNG's Supreme Court.
In June, the government said it "strongly denied" such claims. However, it elected to offer the settlement - and cover an estimated A$20m in costs - rather than proceed to a six-month trial.
Immigration Minister Peter Dutton said it was an appropriate outcome because a trial would have cost "tens of millions of dollars in legal fees alone, with an unknown outcome".
Earlier this week, the Australian court heard that some detainees believed the A$70m figure was not enough.
One current detainee, Amir Taghinia, told the Australian Broadcasting Corp that he had opted out of the settlement because it did nothing to help his situation.
"We are still suffering from the same conditions, under the cruel regime of the defendant, and the case is finished, the case says 'yeah, that's it, it is already settled,'" he said.
Law firm Slater and Gordon, which brought the class action, has said the payout is largest human rights settlement in Australia's history.
Australia has insisted that no-one held on Manus or Nauru will ever be re-settled in Australia.
It says its tough offshore detention policy deters asylum seekers from attempting the life-threatening voyage to its shores in trafficking boats.
However, the policy has frequently drawn controversy and deaths have occurred on Manus Island, including one last month.
The UN's refugee agency (UNHCR) has criticised Australia's offshore detention policy for causing "extensive" harm and breaching international law.
Australia will close the Manus Island detention centre by the end of October.
Although some refugees may be resettled in the US, the fate of the 800 men still on the island remains unclear.