TORONTO -- An Ontario judge inappropriately relied on "rape literature" to assess evidence in the case of a man found guilty last year of sexually assaulting a woman with whom he had a casual relationship, an appeal judge said Thursday in overturning the conviction.

Ontario Superior Justice Michael Dambrot said he was ordering a new trial for Mustafa Ururyar "with considerable regret," noting that doing so "because of inadequacies and excesses in the reasons for judgment does no service to the complainant or the appellant."

Dambrot said Justice Marvin Zuker gave no explanation for dismissing Ururyar's evidence, which included testimony that he had consensual sex with Mandi Gray, who waived the standard publication ban on the identity of sexual assault complainants.

Instead, the trial judge appeared to "reason backwards from literature about rape and how rapists behave to the identification of the accused as a rapist," Dambrot said.

"All witnesses, not just rape complainants, are entitled to have their credibility assessed on the basis of the evidence in the case, rather than on assumptions about human behaviour derived from a trial judge's personal reading of social science literature," said Dambrot.

"I agree with the trial judge that we must be vigilant to reject pernicious stereotypical thinking about the behaviour of women. At the same time, we must not adopt pernicious assumptions about men and their tendency to rape."

Dambrot also suggested Zuker may have plagiarized some parts of his ruling, which he said "reproduce or otherwise draw on" various sources -- such as a New York Times article and the statement given by the victim in the sex assault trial for former Stanford University swimmer Brock Turner -- without attribution.

Zuker declined to comment on the ruling or the allegations of plagiarism, citing the ongoing court case.

The case has drawn considerable attention, with strong opinions being shared online in support of both Ururyar and Gray.

Ururyar had appealed his July 2016 conviction, alleging Zuker was biased and misapprehended some of the evidence.

His lawyer, Mark Halfyard, said after the ruling that his client looks forward to making his case at the retrial.

He said Ururyar has always maintained his innocence.

"This has been an obviously very traumatic and stressful experience and hopefully at some point in the near future it's coming to a close," he said.

Gray said she wasn't surprised by Dambrot's decision.

"I think that this sends a loud, clear message to people who are sexually assaulted: don't bother reporting because you're going to look at the next two, three years of your life being wrapped up in a system that doesn't care about you," she said outside court.

But she said Thursday's ruling doesn't really change anything for her.

"I never needed any man to tell me if I was raped or not," she said. "I still know what happened to me and it doesn't matter what the legal system thinks."

Gray wouldn't say if she'd participate in a new trial. A hearing has been scheduled for Aug. 4.

The appeal also challenged an order that Ururyar give Gray $8,000 to help cover her legal fees. Since Ururyar's conviction was overturned, Gray will not receive the money. However, Dambrot would not rule on the whether the order itself was valid.

A lawyer for the Barbra Schlifer clinic, which was granted intervener status in the case, said that means the restitution order remains "good in law."

"Future cases can rely on it to determine that restitution is appropriate to order," Pam Hrick said outside court.