A Massachusetts man pleaded guilty in federal court Wednesday to mailing threatening letters containing suspicious white powder to a Democratic U.S. senator, Republican congressional candidate and others — including Donald Trump Jr. and his then-wife Vanessa.

Daniel Frisiello, 25, a child-care worker who lives in Beverly, pleaded guilty to 13 counts of mailing a threat to injure the person of another and six counts of false information and hoaxes. Frisiello was arrested and charged on March 1, 2018, and has been in home detention since.

Frisiello, who wore a dark suit, looked down in front of him and put his hand to his mouth as the prosecutor read to the court some of Frisiello's letters filled with profanity and slurs.

Booking photo of Daniel Frisiello, the man charged with sending a series of threatening letters containing a suspicious powder to Donald Trump Jr. Beverly Police Department via Reuters

Assistant U.S. Attorney Scott Garland said Frisiello was a "prolific letter writer" who wrote to public figures and celebrities to share his ideas and request autographs.

But he also had a "darker side," Garland said.

Frisiello mailed five high-profile individuals around the country Boston-postmarked envelopes and packages that contained suspicious white powder and notes indicating that the powder was dangerous and intended to cause harm, according to Andrew E. Lelling, the U.S. Attorney for the District of Massachusetts.

In some cases, included were threatening letters where Frisiello threatened to shoot and kill individuals. One package had also contained a “glitter bomb,” which spilled out upon opening.

Frisiello's guilty plea comes nearly seven months after a suspicious letter was opened by Vanessa Trump inside the Manhattan apartment she shared at the time with her then husband, Donald Jr.

She was sent to the hospital as a precaution after opening the envelope containing a white powder, although the New York Police Department later deemed the substance inside the envelope to be nonhazardous. The letter promised that if Trump did not drop out of the race, the next letter would not be fake.

Other victims include the manager of a Massachusetts company that had recently terminated one of his family members, the heads of four law enforcement agencies in Connecticut and Rhode Island investigating the case of Nathan Carman, the assistant district attorney and judge involved in the trial of Michelle Carter, and Senator Deborah Stabenow, D-Mich., who was apparently targeted because she defended Randall Margraves, a father who charged at Nassar during his sentencing.

Frisiello was linked to the threatening letters through fingerprints and further investigation of trash recovered from his residence which contained remnants of the cut-out computer-printed messages that were sent.

U.S. District Court Judge Nathaniel M. Gorton scheduled a sentencing hearing for Jan. 16, 2019.