Canada has swept aside all of its anti-prostitution laws after a group of sex workers fought for safer working conditions following the brutal murder of six prostitutes by a serial killer in Vancouver.
In a 9-0 ruling, the country's Supreme Court judged that that existing laws violated the guarantee to life, liberty and security of the person.
Though prostitution is not illegal in Canada, three activities associated with it are.
Laws prohibiting keeping a brothel, living on the avails of prostitution, and street soliciting were all struck down by the ruling.
The judgement will not come into immediate effect though, and parliament now has a year to draft new prostitution legislation.
The judgement upholds an Ontario Court of Appeal ruling last year which overturned the ban on brothels because it forced prostitutes onto the street, where they were in greater danger.
Authorities in Ontario had upheld the law against soliciting in public, but the Court of Appeal also repealed this legislation.
Chief Justice Beverley McLachlin, writing on behalf of the court, said that Canada's social attitudes had changed since 1990, when the court upheld the anti-prostitution laws.
"The prohibitions at issue do not merely impose conditions on how prostitutes operate.
"They go a critical step further, by imposing dangerous conditions on prostitution; they prevent people engaged in a risky - but legal - activity from taking steps to protect themselves from the risks," she said.
However, some women's rights groups attacked the ruling.
"We've now had it confirmed that it's OK to buy and sell women and girls in this country," Kim Pate, executive director of the Canadian Association of Elizabeth Fry Societies, told the Canadian Broadcasting Corporation.
"I think generations to come - our daughters, their granddaughters and on - will look back and say, 'What were they thinking?'"
The sex trade workers who brought the case argued that recent high profile cases highlighted the dangers prostitutes working on the streets faced, including the murders committed by Robert Pickton, who in 2007 was convicted of murdering six prostitutes whose remains were found on his pig farm outside British Columbia.
"I'm shocked and pleased that our sex laws will not cause us harm in a year," Amy Lebovitch, one of the three women - all current or former sex workers - who challenged the law, told a press conference.
"The harms identified by the courts below are grossly disproportionate to the deterrence of community disruption that is the object of the law," McLachlin wrote. "Parliament has the power to regulate against nuisances, but not at the cost of the health, safety and lives of prostitutes."
The Supreme Court appeared to acknowledge the Pickton case in the ruling, saying: "A law that prevents street prostitutes from resorting to a safe haven such as Grandma's House while a suspected serial killer prowls the streets, is a law that has lost sight of its purpose."
Grandma's House was a safe house for prostitutes established in Vancouver's Downtown Eastside, where the city's red light district is located, while fears were growing that a serial killer was targeting street workers.