NEW YORK (AP) — The FBI said it needed a search warrant for thousands of Hillary Clinton’s emails discovered on a computer belonging to former U.S. Rep. Anthony Weiner in part because agents wanted to look for evidence of “intrusions” by people trying to steal classified information, according to court documents made public Tuesday.

The search warrant application, written by an agent whose name was blacked out, was filed Oct. 30, two days after FBI Director James Comey informed Congress that investigators had discovered a new trove of email correspondence that could be pertinent to an investigation he had closed over the summer into Clinton’s use of a private server to handle emails she sent and received as secretary of state.

In it, agents laid out their rationale for reopening the probe. They wrote that thousands of emails between Clinton and one of her top aides, Huma Abedin, had been discovered on a Dell laptop used by Weiner, Abedin’s estranged husband.

And, based on their previous work in the case, the agents said they had reason to suspect that those emails might contain classified material, possibly including top secret information that could cause “grave damage to national security” if disclosed.

“A complete forensic analysis and review,” the agent wrote, “will also allow the FBI to determine if there is any evidence of computer intrusions into the subject laptop, and to determine if classified information was accessed by unauthorized users or transferred to any other unauthorized systems.”

A magistrate judge signed off on the search warrant the same day.

After getting court consent to delve into the newly discovered emails on Oct. 30, agents spent several days analyzing them before Comey announced that they contained no new evidence of any wrongdoing by Clinton.

The surprise restart of the email probe, however, upended the presidential race just days before the election. Clinton supporters have blamed the investigation for her loss to Republican Donald Trump.

Weiner’s laptop was initially seized by agents investigating his online relationship with a teenage girl in North Carolina.

That inquiry is ongoing.

In statement, E. Randol Schoenberg, a Los Angeles lawyer who had sued to obtain the court papers, said he saw “nothing at all in the search warrant application that would give rise to probable cause, nothing that would make anyone suspect that there was anything on the laptop beyond what the FBI had already searched and determined not to be evidence of a crime, nothing to suggest that there would be anything other than routine correspondence between Secretary Clinton and her longtime aide Huma Abedin.”

U.S. District Judge P. Kevin Castel ruled Monday that the public had a right to see the search warrant application and supporting court paperwork, but he said portions would be blacked out to protect the identity of the investigating agents.

The judge also ordered the redaction of sections of the paperwork related to the ongoing investigation into Weiner’s online correspondence.