Image caption The court was concerned that restrictions on the sex trade violate the rights of sex workers

Prostitutes should be allowed to work from brothels, but soliciting must remain illegal, the highest court in Canada's Ontario province has ruled.

TheCourt of Appeal upheldtwo of three 2010 decisions by a lower court, effectively overturning legislation passed by Canada's federal government.

While soliciting will remain banned, pimping should be allowed, the court said, except in cases of exploitation.

Ontario's government may consider an appeal to Canada's Supreme Court.

Prostitution is not illegal in Canada, but many of the services and practices associated with it are heavily regulated by law.

Correspondents say the national government may have to find new ways of regulating the sex trade if the Ontario rulings are upheld by the Canadian Supreme Court.

Monday's decisions were both stayed by the court, though - the brothel ruling for 12 months and the pimping judgement for 30 days.

The judges said the stays would allow Canada's federal government time to craft a response to the ruling.

Rights and freedoms

In its ruling, the Ontario Court of Appeal found that the laws banning brothels and pimping violated the rights of sex workers by stopping them from working out of their own homes or from using security or bodyguards.

"It's something that we take very seriously," Ontario's Attorney General John Gerretsen said, concerning the sex worker issue.

"We want to talk to our federal counterparts on this. It's their criminal law that basically was called into question here and they're the people that will have to deal with this issue if any legislative action is taken," he told reporters.

The court ruled on three decisions made in 2010 by Superior Court Justice Susan Himel.

She had said that all three national sex worker laws were unconstitutional, and said brothels, pimping and soliciting should all be allowed.

While the Court of Appeal backed her stance on brothels - calling the existing law "overly broad" - and on pimping, with some exceptions, it disagreed strongly with her ruling on advertising or communicating the availability of sex services.

That law should stand, the court ruled, saying the judge had made "several errors" in her original decision.

In her131-page rulingin 2010, Judge Himel found the national laws violated a provision of the constitution guaranteeing "the right to life, liberty and security".

One of the three prostitutes who brought the case, Terri Bedford, had told the court she had been beaten and raped many times.

She described the judgement as "like emancipation day for sex trade workers".

Street prostitution in Canada has been under increased scrutiny in recent years following the trial of Robert Pickton, a Vancouver pig farmer convicted in 2007 of killing six sex workers.