Australia's highest court has ruled that the country's policy of sending asylum seekers who try to reach its shores by boat to migrant camps in Papua New Guinea is valid.
The decision by the High Court of Australia on Thursday follows a ruling by Papua New Guinea's Supreme Court last year that found Australia's detention of asylum seekers on the Pacific nation's Manus Island was unconstitutional.
Both Australia and Papua New Guinea have said the Manus camp will close by October, but the fate of the men living there remains in doubt.
The High Court challenge to Australia's policy was launched by an Iranian asylum seeker who has been held on Manus since 2013.
The court decided the policy was valid, in part because the Australian government was not constitutionally limited by any need to conform to the domestic law of another country.
Australia refuses to resettle any asylum seekers who try to reach its shores by boat.
Instead, the country pays Papua New Guinea and the Pacific island nation of Nauru to house them in camps condemned as draconian by human rights advocates.
The policy has faced multiple court challenges in both Australia and Papua New Guinea.
In June, Australia reached a settlement of around 90 million Australian dollars (£55 million) with more than 1,900 asylum seekers currently or formerly held on Manus.
The asylum seekers sued the Australian government over alleged physical and psychological injuries they say they suffered as a result of the conditions on the island, and for false imprisonment.
Australia has insisted its policy of refusing to settle migrants who come by boat is necessary to deter them from making the dangerous and often deadly ocean crossings in the first place.
But the policy has left scores of refugees languishing for years on the islands with few viable options over where they can live next.
The United States is considering resettling up to 1,250 refugees from Manus and Nauru under a deal Australia struck with the US when Barack Obama was president.
But President Donald Trump was infuriated upon learning of the agreement, and it is not yet clear how many - if any - refugees the US will agree to take.