Ontario's top court says a ban on brothels puts prostitutes at risk and is unconstitutional. The case could set a precedent for Canada at large.

The Ontario court of appeal ruled on Monday that the ban put prostitutes in danger and that they should be allowed to work safely indoors.

The court has given the government one year to rewrite the law if it chooses to.

At the same time, the court said concerns about the nuisance created by street prostitution were real, so has upheld the ban on soliciting for the purposes of selling sex.

Prostitution itself is not illegal in Canada, but communicating for the purposes of prostitution, pimping and operating a brothel were considered criminal acts. A lower court judge ruled in 2010 that the prostitution-related laws were unconstitutional.