Ontario’s top court has legalized brothels, saying Canadian prostitution laws unfairly discriminate against prostitutes and their ability to work in safe environments.

A panel of five judges wrote that the law banning common bawdy houses “is grossly disproportionate” if all it aims to do is keep public order in a neighborhood and maintain public health standards.

“The record is clear that the safest way to sell sex is for a prostitute to work indoors, in a location under her control,” the judges wrote in a much anticipated ruling. “The impact on those put at risk by the legislation is extreme,” the judges added.

However, the court stopped short of allowing prostitutes to openly solicit customers on the streets. The court ruled that prohibiting solicitation remains a “a reasonable limit on the right to freedom of expression.”

Supporters of the ruling said the laws governing prostitution in Canada would now have to change: “Any form of criminalization pushes the industry underground and gives opportunities to predators. You can see it through the world,” said Nikki Thomas, executive director of Sex Professionals of Canada.

The judicial panel ruled that the changes should not take affect for at least one year, allowing the government to amend its criminal code. Any of those changes would apply to the entire country, not just the province of Ontario. But the Canadian government released a statement saying it was now weighing its legal options.