MONTREAL -- A Quebec author charged with producing child pornography in connection with fictional scenes in a horror novel has been acquitted in a ruling that also declared part of Canada's law invalid.

Quebec Superior Court Justice Marc-Andre Blanchard ruled Thursday that certain articles of Canada's child pornography laws cast too wide a net, targeting works of literature that don't endorse or promote pedophilia.

The judge said that under the law, libraries and book stores could "potentially find themselves in the position of facing charges of possession or distribution of child pornography since they possess, lend or sell such works."

He ruled that two of the articles in the Criminal Code violate sections of the Charter of Rights and Freedoms guaranteeing the right to freedom of expression and to life, liberty and security of the person.

Yvan Godbout had been charged with producing child pornography over passages found in his horror novel, "Hansel et Gretel," which include scenes of sexual abuse of a minor-aged brother and sister.

Godbout had argued that the author of a fictional horror novel that neither advocates nor counsels pedophilia should not see his freedom of expression restricted through criminal charges that carry a devastating social stigma.

He also argued that there is no evidence to show that such written works of fiction cause any harm to children.

The court's ruling was welcomed Friday by PEN Canada, an organization that advocates for freedom of expression for writers.

"Its very important that in cases like this, courts always take into account the creative licence authors need, and they don't put a chill on it," Brendan de Caires, the group's executive director, said in a phone interview.

In a statement published Friday on Facebook, Godbout's publishing house, which was also charged in the matter, said it was pleased with the verdict.

"These charges have had terrible consequences on our operations and on our author, Yvan Godbout," Editions AdA wrote. The statement thanked book stores, publishers, distributors and politicians for their support.

"We want to take the time today to thank our guardian angels during this interminable torment."

At trial, Quebec's attorney general had acknowledged a violation of Godbout's freedom of expression but argued it was justified in order to protect society's youngest and most vulnerable. All material depicting sexual acts with children is harmful, it was argued.

In a 55-page decision, Blanchard largely sided with Godbout.

While sexual material involving minors is clearly harmful, "the court believes we must distinguish between material that exposes a tangible reality, videos or photos or even drawings, from literary fiction," he wrote.

Blanchard also acknowledged that the process caused Godbout significant psychological distress, noting charges of child pornography lead to a greater social stigma than many other crimes.

The ruling recounts Godbout's testimony that police burst into his room at 6 a.m. while he was sleeping, treated him in a humiliating manner and seized his electronics. A five-hour interrogation followed, with lines of questioning that Godbout claims suggested he was a pedophile.

While he said this did not factor into his decision on the constitutionality of the law, Blanchard described the arrest as "shocking."

"We are not in the presence of a potential pedophile whom we must corner or catch in the act, or who we fear will remove the evidence, but rather an author of a novel, which certainly contains pedo-pornographic passages, but who sells his work in broad daylight and to the public, in particular, in Costco warehouse stores," Blanchard wrote.

The judge noted the law was broadened in 2005 to include not just material that advocates for, or encourages, pedophilia, but any description of sexual acts with children, as long as the description is a dominant characteristic of the work of fiction and is done with a sexual purpose.

By that definition, the judge noted, some victims of sexual assault could not legally speak out about their experiences.

Blanchard said the expanded law effectively rendered illegal an overly wide swath of literature, unduly limiting freedom of expression.

He concluded that the concepts of "advocating" and "advising" sexual activity with a minor, or an equivalent, should be a "prerequisite for the constitutional validity" of laws criminalizing materials that contain pornographic passages.

- This report by The Canadian Press was first published Sept 25, 2020.