Australia's High Court has ruled that the government's offshore detention of refugees is legal, sparking an outcry from the UN and human rights groups.

The verdict, announced on Wednesday, paves the way for 267 asylum-seekers currently in Australia to be deported to the Pacific island of Nauru.

The group includes 39 children as well as 33 babies who were born in Australia.

The legal case was brought by a Bangladeshi woman whose lawyers said her imprisonment on Nauru had been "funded, authorised, procured and effectively controlled" by the Australian government, without the constitutional power to do so.

Reacting to the decision, Prime Minister Malcolm Turnbull said the court's decision was "significant".

The government will keep Australia's borders secure and stop drownings at sea, he said, continuing the official line that offshore processing acts as a deterrent for asylum-seekers looking to make the dangerous crossing to Australia from Indonesia or beyond.

The [government] has acted decisively to stop the criminal trade, added Turnbull.

The United Nations Children's Fund, UNICEF, however, issued a statement saying that the ruling "has no bearing on Australia’s moral responsibility or its obligations to protect the rights of children in accordance with international human rights law".

"It is unreasonable for the Australian government to shift responsibility for this group of children and families with complex needs to a developing state in the region," the statement said.

READ MORE: Australia running out of countries to send its refugees

"UNICEF Australia is also concerned for children who were born in Australia but who may be transferred to Nauru on the basis of a decision by the minister for immigration and border protection.

"The current offshore immigration network is a system in crisis and is creating crisis for affected children and families."

Amnesty International weighed in on the decision, saying "all asylum seekers on Nauru suffer the effects of harsh living conditions".

"Despite the High Court decision in this case, Amnesty International calls on Prime Minister Turnbull to do the right thing and permanently close the centre on Nauru and relocate the asylum-seekers held there into our community," said Graham Thom, Amnesty Australia's refugee coordinator.

"The Nauru processing centre puts vulnerable people at risk and operates with an unacceptable lack of transparency."

On social media, Australians also called on the government to allow the refugees to stay in Australia, using the Twitter hashtag #LetThemStay.

The government had also passed retrospective legislation in an attempt to hold off the challenge. In June 2015, laws were passed with bipartisan parliamentary support that made the funding of the centres legal.

In October 2015, only two days before the High Court was due to hear legal arguments in this current case, the Nauru Centre was "opened", allowing asylum-seekers free movement around the island.

The asylum-seekers were no longer officially detained, thereby distancing the Australian government from any claims of illegal detention.

The first of the 267 asylum-seekers could be deported to Nauru as soon as this weekend.

Additional reporting by Anneliese Mcauliffe