Ontario's Court of Appeal has struck down Canada's ban on brothels or "bawdy houses," but says the ban on communicating for the purposes of selling sex should stand.

In a 132-page landmark decision, the court said Monday that the ban on brothels puts prostitutes in danger by forcing them to ply their trade outdoors. It said sex trade workers should be allowed to work safely indoors.

The court said the law against brothels was too broad because "it captures conduct that is unlikely to lead to the problems Parliament seeks to curtail." It said the impact is "grossly disproportionate" to the law's intent because "the safest way to sell sex is for a prostitute to work indoors in a location under her control."

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

But the court upheld the ban on solicitation because it believed that concerns about the nuisance created by street prostitution is real.

"While street prostitution poses real and grave dangers to the prostitutes themselves, it also has a profound impact on the members of the surrounding community," the five-justice panel wrote.

They conceded that the law prevents some prostitutes from speaking openly with potential customers during negotiations so they can screen out dangerous clients. But they reasoned that by making indoor prostitution legal, outdoor prostitutes will be able to move into homes or brothels.

The court also said the law against living off the avails of prostitution should be modified so that it allows prostitutes to use the services of bodyguards. It said that could be accomplished by ensuring that the law applies only to those who live on the avails of prostitution "in circumstances of exploitation."

"If the living on the avails provision were narrowly tailored to target pimps or others who exploit prostitutes, it could pass constitutional muster," the justices wrote. "But the section does not simply target pimps, and its effects reach the safety and security of prostitutes."

It's expected the Court of Appeal's ruling will be appealed to the Supreme Court of Canada. A final decision on the contentious provisions is likely at least a year away.

Advocates for sex workers pleased

Lawyer Alan Young, who launched the appeal on behalf of sex-trade workers, appeared pleased with the decision, saying it signals that prostitutes are no longer second-class citizens who should "just be quiet about their plight."

He said: "The new spring has come for sex workers, a new era has been ushered in."

Valerie Scott, one of three women involved in the case, said that with this ruling, the court "pretty much declared sex workers persons."

Scott told reporters: "I didn't think I would see that in my lifetime, but here we are."

She said that for years now, the vast majority of sex work has taken place indoors and that Monday's ruling appears to acknowledge that.

As for the ruling on living on the avails, Scott emphasized that it's "pivotally important" for prostitutes to be able to have staff like drivers, bodyguards and receptionists.

"When you have people around, generally, you don't see as much violence," she said, adding that she's glad that the occupation of sex work is being brought out to the fore.

"It's just so nice to see that we are now being brought out into society. I feel almost like we're debutantes at a ball," Scott said.

The federal government says it will review the court's decision.

In a statement from his office, Justice Minister Rob Nicholson says his government sees a social need for laws to control prostitution, which he called bad for society and harmful to communities.

Accepting money in return for sex is not illegal in Canada, but soliciting, living on the avails of prostitution, and bawdy houses have been.

In 2010, Ontario Superior Court Justice Susan Himel ruled the laws banning those activities were fundamentally unjust and made life more dangerous for sex-trade workers.

The federal government appealed that decision. It argued in court last June that the laws are necessary for police to control prostitution and to protect women from harm at the hands of pimps.