Citing free speech rights, a Marin County judge has dismissed a criminal charge against a woman who violated a court order with a blog about her estranged husband.

The case stemmed from the divorce proceedings of Melissanne Velyvis and Dr. John Velyvis. Mrs. Velyvis, who alleged she was a victim of domestic abuse, posted a series of online articles and recordings to disseminate her claims.

Dr. Velyvis, an orthopedic surgeon, was arrested by Novato police in 2013 and 2014 on domestic violence allegations. The Marin County District Attorney’s Office declined to file charges in both cases.

During a divorce hearing in 2018, lawyers for the doctor sought a restraining order barring his wife from publishing disparaging comments online. Judge Beverly Wood granted the order, saying the posts were part of an overall pattern of conduct that “crossed the line into harassment.”

“I really came into this hearing not wanting to issue this order and really hoping that I wouldn’t have to issue this order, but it has to stop,” Wood said, according to a transcript of the proceeding. “It really has to stop. And I need to tell you that if you don’t stop this, this can become a criminal matter. I don’t think you want to go there.”

Ms. Velyvis went there, and district attorney’s office charged her in December with violating the restraining order. She retained Will Morehead, a San Anselmo defense attorney and former Marin prosecutor, to fight the charge.

Morehead filed a petition with a different judge, Roy Chernus, arguing that the misdemeanor be dismissed. In court filings, Morehead said the “imprudent and ill-conceived” case was a violation of Ms. Velyvis’ rights under the First Amendment.

Morehead said the criminal charge, and the underlying restraining order, failed to distinguish between harassing speech directed at someone and constitutionally protected speech about someone to a wider audience.

“Americans are free to say critical things about each other in the public discourse,” Morehead wrote. “If so publicly criticized, one can then respond, criticize back, even sue for defamation if applicable. But one may not use the coercive power of the legal system to protect one’s social standing by stopping the speech.”

The prosecutor, Deputy District Attorney Roopa Krishna, said the restraining order was a legitimate exception to First Amendment protections because of a larger pattern of unlawful harassment.

Chernus ruled on the petition on July 27. He agreed that the prior court order was an unconstitutional block on free speech, and said the criminal charge could not stand.

“In California, a court must find that ‘extraordinary circumstances’ exist in order to restrain the defendant’s right to share independently obtained information about another adult with other willing adults,” Chernus wrote. “The fact the public sharing of these comments might be humiliating to the targeted adult, or cause emotional distress or even cause harm to the subject’s professional reputation, does not rise to the level of a compelling or extraordinary circumstance.”

Chernus’ ruling applies only to the online posts, not to other aspects of the restraining order that prohibit unwanted contact, said Trevor Jackson, a lawyer for Dr. Velyvis.

“We do not agree with the outcome, and we are reviewing all remedies available to obtain an order which prevents the harassment at issue,” said Jackson, who is based in Napa. “It takes time for the law to catch up with evolving technology, especially as it relates to the public policy interests in preventing domestic violence against a perpetrator’s contended First Amendment violation.”

Marin County District Attorney Lori Frugoli declined to comment on Chernus’ ruling.

“We file cases when we ethically believe we can prove the charges beyond a reasonable doubt,” she said.

Eugene Volokh, a University of California, Los Angeles, law professor who specializes in free speech issues, said the Velyvis case is “a useful reminder that our First Amendment rights don’t vanish” for litigants in family court.

“Judges aren’t allowed to tell us to stop discussing certain topics — whether they’re big-picture politics or just our personal relationships,” Volokh said. “Some narrow categories of speech, such as libel and threats of criminal attack are constitutionally unprotected. But speech about our exes is covered by the First Amendment.”

The Velyvises, now divorced, have moved out of the state. She resides in Texas and he in West Virginia, although he maintains a medical office in the Bay Area.