A former congressional Democratic staff member pleaded guilty to posting private information about Republican senators on the website Wikipedia and threatening a witness who caught him on a computer in another lawmaker’s office.

Jackson A. Cosko, 27, of the District, admitted on Friday to “doxing” the senators after he became angry about being fired by one senator and then grew angry at other senators as he watched the hearing that addressed sexual assault allegations against then-Supreme Court nominee Brett M. Kavanaugh, his plea agreement shows.

Cosko pleaded guilty to two counts of making public restricted personal information and one count each of computer fraud, witness tampering and obstruction of justice.

In plea papers, he acknowledged the senators were GOP Senate Judiciary Committee members Lindsey O. Graham (S.C.); Mike Lee and Orrin G. Hatch of Utah; as well as Sen. Rand Paul and Senate Majority Leader Mitch McConnell of Kentucky.

Cosko’s lawyer Brian W. Stolarz said in a statement, “Mr. Cosko takes full responsibility for his actions and is sincerely remorseful. Sadly, Mr. Cosko’s ongoing struggle with drugs contributed to a regrettable course of conduct. He is committed to rehabilitating his life, his reputation, and addressing his addiction.”

Cosko was arrested Oct. 3 by U.S. Capitol Police, who said he was caught sneaking into the offices of Sen. Maggie Hassan (D-N.H.) after 10 the previous evening and using an aide’s computer and log-in, according to court filings.

Another aide recognized Cosko, ordered him to leave and called police, the defendant acknowledged in plea papers.

Minutes later, that aide received a threatening email with the subject line “I own Everything” and a text stating, “If you tell anyone I will leak it all. Emails signal conversations gmails. Senators children’s health information and socials,” according to plea papers.

Cosko, angry that he was fired from Hassan’s office in May, had “engaged in an extraordinarily extensive data theft scheme” by burglarizing the office several times, copying network drives and identifying sensitive information he might use later, he admitted in court filings.

On Sept. 27, Cosko “became angry” while watching Kavanaugh’s televised testimony before the Senate Judiciary Committee and subsequently doxed five senators by anonymously editing their Wikipedia pages to add phone numbers and home addresses, he admitted to the court. The information was quickly removed after the doxing was discovered and aides contacted authorities.

Data on three senators was posted shortly before 6 p.m. Sept. 27, and on two others just before 6 p.m. Oct. 1, according to court filings.

Edits to Paul’s page came after the senator called for an investigation into earlier posts and included the statements: “He dares call for an investigation of ME?!?!?!?” and “I am the Golden God,” as well as “We are malicious and hostile” and “Send us bitcoins.”

The five federal felony counts to which Cosko pleaded guilty carry maximum penalties of up to 20 years in prison.

Under a plea agreement, prosecutors said a sentencing range of 46 to 57 months applied under federal guidelines. Cosko’s defense said the applicable advisory range would be between 30 and 37 months. Both sides agreed Cosko could not argue for less than a two-year term.

U.S. District Judge Thomas F. Hogan of the District of Columbia accepted the plea and set sentencing for June 13. Cosko has served about four months behind bars since he was charged.