Australia's offshore asylum policy ruled legal by High Court
Australia's High Court has ruled that the government's policy of detaining asylum seekers offshore is legal.
The court rejected a challenge brought by lawyers for one detainee who argued the policy was unconstitutional.
The ruling paves the way for more than 250 people, including 37 babies, to be deported to a detention camp on the tiny Pacific island nation of Nauru.
PM Malcolm Turnbull said the borders had to be secure, and repeated the view that the policy prevents deaths.
"Our commitment today is simply this: the people smugglers will not prevail over our sovereignty. Our borders are secure. The line has to be drawn somewhere and it is drawn at our border," he said.
Rights groups have reported harsh conditions, violence and abuses at the camps, while Australian senators have said Nauru is not safe for children.
Analysis: Jon Donnison, BBC News, Sydney
This is a significant victory for Australia's conservative government and its tough stance towards asylum seekers.
For several years now Australia has effectively outsourced its asylum seeker problem, paying hundreds of millions of dollars to both Nauru and Papua New Guinea to house offshore detention centres. The court ruling judged that to be legal.
Human rights groups say the ruling will mean more than 200 asylum seekers who came to Australia to seek medical treatment, including 37 babies born here as well as around 50 children, will be forced to leave and return to Nauru.
There has been particular controversy around the case of a five-year-old boy who was allegedly raped while being detained in Nauru but who could now be forced to go back. The government says it will seek medical advice before making a decision regarding the boy.
Despite widespread criticism internationally towards Australia's treatment of asylum seekers, polls show the policies which have stopped asylum seekers trying to reach Australia's shores are broadly popular here with the public.
The High Court case was brought by an unnamed Bangladeshi woman who was held on Nauru after trying to enter Australia illegally by boat.
She was later taken to Australia while pregnant for medical treatment and gave birth there.
In what was seen as a test case for other detainees, she then tried to stop the government sending her back to Nauru.
The Human Rights Law Centre spent nine months arguing that Australia had broken the law by sending her there.
But the court rejected this in a six-to-one ruling, but it did stress that people cannot legally be held in camps indefinitely.
About 500 migrants are currently living on Nauru, 3,000 km (1,800 miles) northeast of Australia.
The ruling has immediate implications for 267 other people also taken to Australia from the camps for medical treatment, including 37 babies born in Australia.
They are now expected to be deported.
Human rights lawyer Claire Hammerton told the BBC the evidence of extreme mental health problems suffered by children in Nauru was compelling, but that the ruling was the last chance to challenge it.
"Children in detention in Australia who are slated to be transferred to Nauru consistently tell us they are living with daily fear and anxiety about being sent there. These children they don't understand why they are being treated like criminals," she said.
Speaking in parliament after the ruling, Prime Minister Malcolm Turnbull defended the controversial border security arrangements, saying they were necessary to deter and prevent people smuggling.
Meanwhile the Australian arm of UN's children fund Unicef said the ruling had "no bearing in Australia's moral responsibility or its obligations to protect the rights of children".
Unicef said it was "unreasonable" for Australia to "shift responsibility" to a developing country.
Australia intercepts all boats bringing suspected asylum seekers to its territory and takes those on board to Nauru or to Manus Island in Papua New Guinea.
Even if they are found to be genuine refugees they will not be allowed to settle in Australia.
The government says the policy deters people smuggling and saves lives at sea, but it has been widely criticised as breaking Australia's legal obligations.