Iranian asylum seekers who were caught in Indonesian waters while sailing to Australia on a boat in Bali, Indonesia. (AP)

Papua New Guinea's prime minister says the island nation will close its asylum seeker detention centre after the Supreme Court ruled that Australia's detention of men there is illegal.

Peter O'Neill said in a statement that the facility on Papua New Guinea's Manus Island would be closed and the country would immediately ask the Australian government to make arrangements for the asylum seekers being held there.

Australian officials have been scrambling to respond to a court ruling that has thrown into jeopardy its policy of refusing to accept asylum seekers 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.

The fate of 900 men being held on Manus Island is in limbo after t he decision prompted fresh questions about Australia's divisive policy of refusing to accept asylum seekers who try to reach its shores by boat.

"We did not anticipate the asylum seekers to be kept as long as they have at the Manus centre," Mr O'Neill said in a statement.

He said those deemed to be legitimate refugees could resettle in Papua New Guinea "if they wish to be a part of our society and make a contribution to our community".

"It is clear that several of these refugees do not want to settle in Papua New Guinea and that is their decision," he said.

His announcement, which gave no timeframe for the facility's closure, follows a ruling by the nation's Supreme Court on Tuesday that said the detention of the men at Manus was a violation of their constitutional right to personal liberty.

Australian officials have been scrambling to respond to the decision, with immigration minister Peter Dutton saying none of the men will be resettled in Australia despite the pleas of human rights groups.

The chaos came as an Iranian refugee at Australia's detention centre on Nauru set himself on fire in an apparent protest over strict asylum seeker policies. Mr Dutton said the man would be airlifted off the island for medical treatment.

"He is in a very, very serious condition and his outlook is not good at all," Mr Dutton told reporters.

He insisted the court ruling would not change Australia's policy.Officials are in talks with other countries that could potentially take detainees who are declared genuine refugees, Mr Dutton said. Australia already has a deal with Cambodia that allows refugees held on Nauru to settle there, though only five people have taken up that option.

Australian prime minister Malcolm Turnbull said the government had no immediate plan to contend with Tuesday's court ruling, which ordered both countries' governments to quickly end the detention of the men at the facility.

"We were not a party to the litigation, as you know, but this is something that's under consideration," he told reporters in Brisbane. "I can't provide a definitive road map from here."

The 23-year-old Iranian refugee on Nauru set himself on fire in a protest intended to coincide with a visit to the island by representatives of the UN refugee agency, Nauru's government said in a statement.

Self-harming incidents happen on occasion at Australia's immigration detention camps, with asylum seekers cutting themselves, swallowing chemicals or sewing their mouths shut as a form of protest, but Wednesday's incident was particularly serious.

Asked if he felt any responsibility over the apparent desperation of asylum seekers languishing in detention, Mr Dutton replied: "I feel terribly for people that have been conned by people smugglers to pay thousands of dollars believing that they were coming to Australia."