A transgender Lawrence woman and Level 3 sex offender, who threatened to kill one judge and told another she hopes he “burns in hell” after he denied her request to be sent to the state’s female prison, is going to a lockup — ?for men.

Debbie Moccia, a 60-year-old registered Level 3 sex offender, pleaded guilty on Thursday and apologized for making the threats in court, and Salem Superior Court Judge David Lowy sentenced her to 2 1⁄2 years and two years’ probation, according to Essex District Attorney spokeswoman ?Carrie Kimball Monahan.

Prosecutors recommended a four-to-eight-year state prison sentence.

Lowy was nominated by Gov. Charlie Baker this week to serve as a justice on the Massachusetts Supreme Judicial Court.

Moccia made the first threat to Lawrence Judge Lynn Rooney in June 2013, when she was being sentenced on assault and battery charges, ?prosecutors said.

“I’m going to kill you,” Moccia told Rooney, according to prosecutors.

Rooney wrote in a victim impact statement that Moccia is “incredibly disruptive and represents a danger for court personnel and anyone who happens to be in her presence. … Every time she is brought into court, it necessitates extra precautions and extra security because she is unpredictable, violent and often secrets razor blades on her person. She has learned how to play the system over these years as is evidenced by her conduct toward me,” according to The Eagle-Tribune.

Later in 2013, Moccia told Newburyport Judge Peter Doyle she hopes he “burns in hell” for telling her he was unable to send her to the Framingham prison for women, ?officials said.

Moccia has been a Level 3 sex offender since 1986 after she was convicted of indecent assault and battery on a person over 14, according to state records.

Monahan said Moccia — who was born with male anatomy but identifies as a woman — has a balance of more than 500 days served.

The probation order requires Moccia to seek mental health treatment, remain on medication and stay away from the two judges, officials said.