VANCOUVER -- The father of a transgender teenager has been sentenced to six months behind bars after exposing sensitive personal and medical information about his son, in violation of a publication ban intended to protect the boy's privacy.

B.C. Supreme Court Justice Michael Tammen noted that the father, who can only be identified as C.D., had "blatantly, willfully and repeatedly" breached the court order, warranting a serious sentence that would serve as a deterrent to others who might choose to follow in his footsteps.

"Public breaches of court orders are a direct attack on the rule of law," Tammen said.

"He simply chose to disregard those orders, for reasons that have never been explained."

The punishment handed down was much more severe than C.D. and his lawyer were anticipating when he pleaded guilty to criminal contempt of court this week.

Prosecutors had recommended a jail term of 45 days, with credit for the time C.D. has already served since he was taken into custody last month to prevent further breaches. The judge disagreed, arguing such a sentence would be "inadequate, and would tend to bring the administration of justice into disrepute."

The publication ban C.D. violated stems from a family law case the father launched in 2018, when he tried to use the province's court system to prevent his son, who was then 14, from accessing gender-affirming hormone treatments.

The teenager had identified as male for several years at that point, according to court documents, and the treatments were supported by his mother and doctors.

C.D. lost, in a ruling that upheld the right of minors under the B.C. Infants Act to make medical decisions independently of either of their parents if certain conditions are met, including that they have the approval of health-care professionals.

Publication bans in family law cases are commonplace to protect the privacy of minors, and C.D. was ordered not to give interviews using his real name or publicly share information that could expose his underage son to damaging and potentially violent online backlash. The court heard that he did so on numerous occasions, despite multiple warnings.

Tammen pointed to one interview that was uploaded to YouTube in which the father spoke openly about violating what he described as "gag orders."

Some of that material has since been expunged from the internet. But Tammen noted that much of it remains, in part because C.D., after being told he could be found in contempt of court, had proceeded to start speaking to right-wing media organizations based in the U.S., which would be less inclined to remove the content at the request of Canadian authorities.

"C.D. ensured that he would not be fully able to purge his contempt," Tammen said, citing another interview in which the father suggested he was "smarter" than the legal system that was trying to protect his son's privacy.

The court also heard that C.D. put together an online crowdfunding campaign that included a link to a video containing his child's name and picture. The fundraiser collected at least $30,000.

When it comes to this level of contempt, Tammen said, "there are few cases even remotely comparable."

While supporters of C.D.'s have argued that the court order violates his own right to freedom of expression, the judge said the father could have aired his grievances about his family law case, and his son's transition, by giving interviews without using his name or sharing personal details that put his child's privacy in jeopardy. Tammen noted the father did just that in an interview with a Vancouver-based YouTube channel that fully complied with the ban.

The judge also shared a brief excerpt from a victim impact statement provided by C.D.'s son: "I followed the rules of the court order. I don't know why my dad didn't have to."

With credit for time served, C.D. must spend another 134 days in jail. Tammen also ordered that the father take $30,000 from his fundraiser and donate it to the Ronald McDonald House charity.

In an email, defence lawyer Carey Linde said C.D.'s response to the judgment is "stoic acceptance of what he considers an overly strict sentence for a first offence."

The father will not be doing any interviews until he completes his jail time, Linde added.