Papua New Guinea has said it will close a refugee detention centre after the island nation's Supreme Court ruled that Australia's detention of asylum seekers there was illegal.

Prime Minister Peter O'Neill said in a statement on Wednesday that the facility on the country's Manus Island would be closed and his government would immediately ask Australia to make arrangements for the people held there.

 Outsourcing refugees?

Australian officials have been scrambling to respond to the ruling, which has thrown into jeopardy its policy of refusing to accept people who try to reach its shores by boat.

Australia pays Papua New Guinea and the island nation of Nauru to hold them in detention camps instead.

Immigration Minister Peter Dutton said the more than 800 men detained on Manus would not be resettled in Australia under any circumstances, maintaining a policy that has been strongly criticised by the United Nations and human rights groups.

"The government's position is very clear - that is that we are not going to accept people who have sought to come to our country illegally by boat," Dutton told reporters in Melbourne. "They will not settle permanently in our country."


READ MORE: Australia refugees' hunger strike for freedom


Dutton said the Manus detainees could go home or to another country willing to accept them.

"This isn't an intense, toxic political issue in this country. We have got the government and opposition together to see who can be harsher, who can be crueler," Pamela Curr, a refugee rights advocate at the Asylum Seeker Resource Centre, told Al Jazeera.

"Manus has not failed for the first time today. It really is time for Australia to get a grip on reality." 

A second legal case on the immediate fate of the detainees on Manus Island will be heard by the Papua New Guinea Supreme Court later this week.

Lawyers acting on behalf of nearly all the Manus Island detainees will argue that they should be taken to Australia and be compensated for being held in custody.

"Every hour that ticks past is another hour, is another day that Papua New Guinea has not abided by the Supreme Court decision - it will add to the compensation we are requesting from the Supreme Court but particularly it is about freedom for the people that have been held on Manus Island for too long," Ian Rintoul, spokesman for the Refugee Action Coalition, which is funding the second legal case, told the Reuters news agency.


READ MORE: Thousands in Australia protests against refugee centres


Many of the detainees at the camps have harmed themselves, with Dutton on Wednesday confirming that a 23-year-old man from Iran had set himself on fire on Nauru island.

Dutton said the man would be evacuated from the island later on Wednesday.

Source: Al Jazeera and agencies