NEW YORK — A federal judge on Monday ordered the public release of the search warrant that FBI agents used to reopen their investigation of Hillary Clinton’s use of a private email server just weeks before the presidential election.

U.S. District Judge P. Kevin Castel ruled Monday that the public had a right to see the warrant, which he said was secretly filed with the court on Oct. 30.

Agents used the warrant to get access to emails stored on a computer belonging to Anthony Weiner, the estranged husband of top Clinton aide Huma Abedin.

FBI Director James Comey upended the presidential race on Oct. 28 when he informed Congress that agents would be digging through the cache of emails between Abedin and Clinton for any new evidence related to Clinton’s handling of sensitive State Department information.

Two days before the Nov. 8 election, Comey announced that the inquiry had uncovered no new evidence of wrongdoing. Historians will long debate whether the revelations factored into Clinton’s loss to Donald Trump.

The court documents will be unsealed at noon Tuesday, with portions blacked out to conceal the names of the agents. The judge also ordered the redaction of any information about an open investigation of Weiner’s online correspondence with a teenage girl.

Agents initially seized the computer in connection with that investigation.

Weiner, a Democrat, resigned his seat in Congress after sexually explicit texts and social media posts to various women. He tried for a political comeback two years later by running for mayor of New York, but his campaign was undone when evidence emerged that he hadn’t given up his sexting habit.

Federal authorities began investigating him in late September after an online news outlet, the Daily Mail, published an interview with a North Carolina girl who said she had exchanged sexually explicit messages with him over several months.

Randol Schoenberg, a Los Angeles lawyer who specializes in recovering works of art stolen by the Nazis, petitioned the court to make the search warrant and supporting documents public.

In his order, Castel said public interest in the case overrode any privacy considerations.

“Ordinarily, a person whose conduct is the subject of a criminal investigation but is not charged with a crime should not have his or her reputation sullied by the mere circumstance of an investigation,” he wrote. But in this instance, he said, the fact that the FBI investigated Clinton is hardly secret. “She has little remaining privacy interest in the release of the documents identifying her as the subject of this investigation.”

SUBSCRIBE: Get the analysis of Mark Shields and David Brooks delivered to your inbox every week.