Around 900 men are in the detention center on the Papua New Guinean island, according to Australian immigration authorities.
That detention breaches the right to personal liberty in the constitution of Papua New Guinea (PNG), according to the country's Supreme Court, which ordered the PNG and Australian governments to immediately take steps to end the detention of asylum seekers on the island.
Some 1,200 people are currently detained in offshore "regional processing centers" on Manus and Nauru, thousands of miles from Australia, according to immigration authorities.
The camps have been widely condemned
and many have called for their closure. A 2015 Australian Senate inquiry
reported that the camps had poor hygiene, provided little educational opportunities and also documented several instances of sexual assault.
Some detainees have been in the camps for more than three years. Government figures show the average length of detention as 454 days, as of the end of March.
Current and former child detainees at the Nauru camp described it to CNN as a prison
"It's not a crime to want to have a better life and future," said one 18-year-old girl who asked CNN not to reveal her name because she fears for her safety. "We are treated as prisoners."
In a statement, Australian Minister for Immigration and Border Protection Peter Dutton said the court's decision "does not alter Australia's border protection policies."
"No one who attempts to travel to Australia illegally by boat will settle in Australia," he said.
"Those in the Manus Island Regional Processing Centre found to be refugees are able to resettle in Papua New Guinea.
Those found not to be refugees should return to their country of origin. People who have attempted to come illegally by boat and are now in the Manus facility will not be settled in Australia."
'Treat people like human beings'
Campaigners against the detention centers greeted the court's decision.
On Twitter, Greens Senator Sarah Hanson-Young said: "It is well time to close these awful detention camps on Manus (and) Nauru and start treating people like human beings. Anything less is senseless."
Daniel Webb, director of legal advocacy at the Human Rights Law Center, said that the conditions on Manus were "incredibly harmful."
"We've known it's cruel, we've known it's inhumane, today's judgment confirms it's illegal."
He added that Tuesday's ruling should be a "wake up call" to the Australian government.
"Legally there may be a few ways to respond," said Aurora Adams, a human rights campaigner at Get Up.
"Morally there is only one option, the camps must be closed."
She described Dutton's statement as "highly disappointing," adding that there was a clear popular mandate within Australia for the government to change its policy.