OTTAWA -- The Supreme Court of Canada grappled Thursday with whether Canada's prostitution law is at odds with the Constitution as demonstrators on both sides of the debate gathered outside to express their views.

Federal lawyer Michael Morris argued that the Ontario Court of Appeal went too far last year when it struck down the Criminal Code ban on bawdy houses on the grounds that it endangers sex workers by forcing them to work outside.

"In the face of a complex social problem, uncertainty and contradicting social science evidence, we submit that the Ontario Court of Appeal erred," Morris told the court.

Lawyers for the province of Ontario also argued against decriminalization.

Several justices made the point that prostitution itself is not in fact illegal, and raised questions about how that should affect many of the key activities related to it that are in fact banned under sections of the Criminal Code.

Chief Justice Beverley McLachlin, for instance, raised the question of whether that means prostitutes ought to be able to hire security guards and work in secure brothels, off the street.

"It could be Brinks or somebody. I'm not sure they're in that business," she said, sparking muted laughter in the court.

The Ontario Court of Appeal struck down the section that forbids brothels, but it upheld a ban on communication for the purposes of prostitution, which makes street prostitution illegal.

The court also imposed limits on the section that prohibits living off the avails of prostitution to exclude people such as a sex worker's bodyguard, accountant or receptionist. It said the provision should only apply "in circumstances of exploitation."

Federal and provincial lawyers are arguing that the intent of Parliament is impose limits on prostitution.

"The assertion that prostitution is legal in Canada is misleading. Prostitution has always been and remains more illegal than legal in Canada," argued lawyer Jamie Klukach, appearing for the Ontario Attorney General.

In a passionate address to the court, Osgoode Hall law professor Alan Young -- who is leading the court challenge -- argued the opposite.

Young slammed the "mythmaking, fear mongering and storytelling" of his legal opponents and the "powerful, lofty, rarefied statements that don't reflect the law."

He urged the court to set aside moral considerations and stick to the core legal issues.

Young also faced tough questions from the bench. At one point, Justice Michael Moldaver challenged his argument that the prostitution law was an antiquated relic of the past.

Moldaver questioned whether "the thought that any home on any street could at any time be run by a single person and turned into a bawdy house is maybe one that Parliament says, 'we don't want that."'

Young is representing three women at the centre of the case: retired dominatrix Terri-Jean Bedford, former prostitute Valerie Scott and Vancouver sex worker Amy Lebovitch.

"This is going to be the day of reckoning here in Ottawa," Bedford, clad in a leather jacket and carrying a small whip, said on the courthouse steps.

Bedford accused Prime Minister Stephen Harper of "wanting to perpetuate these bad laws. That means that he's doing what organized crime wants him to do."

She called on Harper to tell Canadians "what we can and cannot do in the privacy of our home with another consenting adult. I don't believe these laws are just exclusively for sex trade workers; it's for every Canadian to enjoy their right to privacy."

Several groups spent the day rallying on the steps of the Supreme Court, giving the building's stony facade a carnival atmosphere as more than 100 people gathered under sunny skies to express their opinions.

On one side, the supporters of sex workers formed a small sea of red umbrellas as Bedford held court in a folding chair, posing for photos with well-wishers.

One sign below her read, "Sex Worker Rights are Human Rights."

On the opposite side of the sprawling staircase, another group of young women brandished large banners, one of which read, "Criminalize Johns and Pimps Not Women."

"Criminalization means that, as sex workers, we have no access to the legal system or police protection," said Anna-Aude Caouette, a member of the Montreal group, Stella.

"It also contributes to the stigma and discrimination we face, making it more difficult for us to find social support and to access health services in our communities."

In all, the court set aside five and a half hours to hear from more than a dozen interested parties.

Some groups are arguing for some form of legalization, while others say prostitution must remain against the law.

The case has divided women's groups, pitting sex workers against the front-line organizations that try to help the poor, drug-addicted and often underaged women who become prostitutes.

The Women's Coalition for the Abolition of Prostitution argues the law should be changed to make it illegal to be a pimp or a customer, but not an actual prostitute.

They say the sex industry has victimized young women, many of them underage, forcing them into a life of drugs, physical and sexual abuse, and essentially slavery in an illegal industry from which they cannot break free.

The coalition is made up of seven organizations, including the Canadian Association of Sexual Assault Centres, the Native Women's Association of Canada, and the Canadian Association of Elizabeth Fry Societies.