Updated

A ban on brothels puts prostitutes at risk and is unconstitutional, Ontario's top court ruled Monday, in a case that is expected to be appealed to Canada's top court and have ramifications for the country at large.

The Ontario Court of Appeal said prostitutes should be allowed to work safely indoors.

The court in Canada's most populous province has given the government a year to rewrite the law if it chooses.

At the same time, the court said concerns about the nuisance created by street prostitution are real, having a "profound impact on the members of the surrounding community." So it upheld the ban on soliciting for the purposes of selling sex.

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

Terri-Jean Bedford, a dominatrix, has argued that Canada's sex trade laws force workers from the safety of their homes to face violence on the streets. Bedford's "Bondage Bungalow" north of Toronto was raided by police in 1994.

Valerie Scott, a former prostitute who launched the challenge with Bedford, said prostitutes are safer when they don't have to patrol the streets.

"I'd like to thank the Ontario Court of Appeal justices for pretty much declaring sex workers persons today," Scott said. "I didn't think I'd see it in my lifetime, but here we are.

She noted that the vast majority of sex work has been taking place inside anyway.

"I do worry about my street colleagues. We have to figure out something to make these women and men safe."

Alan Young, lawyer for the women, called the decision a win for sex trade workers and society.

"Canadian society will not collapse or even flinch under the weight of this decision," Young said.

"Eighty percent have moved indoors. The movement has already occurred, and now the law is following afterward. ... We're not going to see a dramatic change in the way the sex trade operates in Canada."

"Prostitution is a controversial topic, one that provokes heated and heartfelt debate about morality, equality, personal autonomy and safety," the court wrote in its decision.

"It is not the court's role to engage in that debate. Our role is to decide whether or not the challenged laws accord with the constitution."