Jackson Cosko, the Democratic staffer accused of “doxxing” Republican senators during the Kavanaugh confirmation fight, was caught after he sneaked into a Senate Democrat’s office earlier this week and tried to use one of their computers, police said in an affidavit made public Thursday.

Mr. Cosko, 27, now stands accused of a number of federal and local crimes after police say he posted personal addresses and telephone numbers of senators to their Wikipedia pages over the last couple of weeks.

He appeared for an initial hearing in U.S. District Court in Washington, D.C., and was ordered detained until a hearing Tuesday.

Mr. Cosko had been working for Rep. Sheila Jackson Lee, a Texas Democrat and staunch Kavanaugh opponent, but her office told reporters he had been fired once they learned of the case against him.

Police said he had worked for a Senate office before, though he was pushed to resign earlier this year. A spokesman for Sen. Maggie Hassan, New Hampshire Democrat, confirmed she had employed him and he had been asked to resign “for failing to follow office procedures.”

“We did not have reason to believe that he posed a risk,” the spokesman said.

It was Ms. Hassan’s office that he sneaked into on Tuesday — and one of her staffers that spotted him and reported him to police, leading to his arrest.

The staffer chased him from the office, then called police after receiving an email threatening retaliation if the intrusion was reported, according to the police affidavit.

Cosko stands accused of leaking personal information, making threats, unauthorized access of a government computer, identity theft and witness tampering — all federal charges — and burglary and unlawful entry, both D.C. charges.

Police linked him to doxxing of several GOP senators over the last couple of weeks. They traced the leaks of public information to the House computer network, and police indicated the leaks were related to Judge Kavanaugh’s confirmation process.

Mr. Cosko’s arrest does dispel an internet rumor last week that claimed the IP address of some of the earlier doxxing events could be traced back to Rep. Maxine Waters, California Democrat. She had vehemently denied that suggestion.