AMELIA COUNTY, Va. (CBS19 NEWS) -- A woman has pleaded guilty to making threats against a sheriff’s office, a judge and the judge’s wife.

According to Louisa County Commonwealth’s Attorney Rusty McGuire, 34-year-old Sarah Pike Leyva pleaded Thursday to two counts of felony threats in writing for posts on the Amelia County Sheriff’s Office social media page.

In 2019, a court in Texas gave custody of Leyva’s children to their father, but she refused to turn them over.

In 2020, the children were located in Amelia County and a judge there said the Texas custody order should be enforced.

Leyva tried to challenge the custody order and failed, so legal custody of the children remained with their father, her ex-husband.

After that attempt failed, Leyva posted Facebook threats against a sheriff in Texas. Charges are still pending in that case.

Then in 2022, Leyva made threats against the Amelia County Sheriff’s Office and a judge of the 11th Judicial Circuit court, who had nothing to do with this case.

However, the judge’s wife served as a guardian ad litem for the children and said the children should be returned to their father in Texas.

Leyva then established a social media following, claiming she was a wronged mother who was being victimized by the judicial system.

For months, she sent emails and made posts on Facebook referring to the judge in Amelia, his wife and the Amelia County Sheriff’s Office as child traffickers.

In September 2022, she posted messages that implied someone should harm the judge and his wife, and it was those messages that led to these charges in Virginia.

“Everyone is sympathetic that the defendant lost custody of her children, but that does not give her the right to call everyone involved in the cases child traffickers and put professionals in fear for their safety through the actions of her social media followers,” said McGuire. “The citizens who monitor the Amelia County Sheriff’s Office Facebook page received deranged calls from unknown followers of the defendant, which caused them grave concern for their safety and well-being. I am sure she will ultimately call me and the judge who heard the case today child traffickers, but we hope that after she addresses her Texas charges she can put these matters behind her and work towards obtaining visitation with her children in Texas.”

Leyva apologized to the victims in court on Thursday, and officials say they hope she continues to take a medication prescribed to her in jail that helps her control her mood and mitigate her anger.

Leyva was sentenced to five years with all but six months suspended.

She will be on active probation after that time and will be required to move out of Amelia County when she is released from jail.

McGuire’s office was brought in to handle this case as a special prosecutor.