Jackson Cosko, the former Democratic staffer accused of “doxing” Republican senators by leaking their personal information, was ordered held without bond Tuesday, with the judge saying he posed a risk to the community.

Prosecutors revealed investigators found cocaine and methamphetamine during a search of his possessions, and speculated he may have been under the influence when, according to police, he used his government credentials to post personal information of some lawmakers at the height of the grueling Kavanaugh-nomination fracas, and broke into a senator’s office while threatening to release other information.

Those threats seemed to worry Magistrate Judge Deborah A. Robinson, who ordered him held without bond, rejecting his lawyers’ pleas that he be released on strict conditions.

Even an offer of having him turned over to his parents, with orders to stay away from electronic devices and wear an ankle bracelet, weren’t enough to sway Judge Robinson.

Police said Mr. Cosko released personal addresses and phone numbers of Sen. Mike Lee of Utah and several other Republican senators, all of them major figures in the confirmation battle over Justice Brett M. Kavanaugh.

“These are serious offenses that were directed at one of the cornerstones of American democracy,” said Assistant U.S. Attorney Demian Ahn.

He said Mr. Cosko was “caught in the act” of breaking into the office of Sen. Maggie Hassan, a New Hampshire Democrat for whom he had worked until being ousted earlier this year. Mr. Ahn said Mr. Cosko had served as a tech staffer with administrative rights in Ms. Hassan’s office, suggesting he had access to more sensitive information. And he had a graduate degree in information technology.

After being confronted by a Hassan staffer who apparently knew him from before, and knew he wasn’t supposed to be in the office, Mr. Cosko sent messages threatening the staffer and warning he had more embarrassing information he would release in retaliation, police say.

Mr. Ahn said when police searched his home, storage unit and car they did find plans to target other lawmakers, and also found notes he had written to himself laying out a checklist for trying to get rid of the evidence of his activities.

“It is virtually a hackers’ obstruction checklist,” the prosecutor said.

The search also turned up powders that tested positive for cocaine and meth, “numerous smoke pipes,” a variety of computers, phones, and tablets, and a Nintendo Switch, PlayStation 4 and X-Box One. Mr. Cosko also had stationery and envelopes from Ms. Hassan’s office, according to the list of items found during the search.

Mr. Cosko had been working for Rep. Sheila Jackson Lee, Texas Democrat, at the time of the doxing, and the government says he used his official login for at least one of his leaks of information.

Ms. Jackson Lee’s office has not responded to multiple inquiries from The Washington Times, though her staff has told Texas newspapers she has fired Mr. Cosko.

Mr. Cosko sat at the defense table studying a copy of the indictment against him as his lawyers and the prosecutors argued over the implications of past drug use and a bench warrant that had been issued earlier this decade for his appearance in court.

His father was also in attendance, and John Hudley, who argued on behalf of Mr. Cosko, said his mother has decided to retire from her job to devote her time to trying to get her son on a better path.

Mr. Hudley challenged the government’s suggestion that Mr. Cosko was a threat, saying that he shouldn’t be held responsible for what other people did with the information he might release.