A Massachusetts man has been sentenced to the time he already served behind bars — about four months — for making threats to a state judge in West Virginia.

Keith Lessard, of Webster, was also sentenced to a year of probation on Thursday.

He pleaded guilty last year to a federal charge of mailing threatening communications.

Federal prosecutors said he was attempting to extort money from the judge by falsely claiming past misconduct when she was a prosecutor in a case against him.

Lessard’s attorney didn’t immediately return a call seeking comment on Saturday.