NEW YORK (AP) — The FBI was trying to get a look at thousands of Hillary Clinton's emails on disgraced former congressman Anthony Weiner's computer partly to see if anyone had hacked in to steal classified information, according to court documents unsealed Tuesday.

Investigating possible hacking appeared to be a secondary rationale for the email search, which FBI Director James Comey launched in the waning days of the presidential election.

When the FBI asked a magistrate judge in New York to issue a search warrant for Weiner's computer on Oct. 30, an agent spent pages describing concerns it might contain evidence Clinton had mishandled classified information.

The warrant application, made public Tuesday, was filed two days after Comey informed Congress investigators had discovered email correspondence that could be pertinent to his recently closed probe of Clinton's use of a private email server while she was secretary of state.

In the document, the agent wrote that thousands of emails between Clinton and top aide Huma Abedin had been discovered on a laptop used by Weiner, Abedin's estranged husband.

At the time, investigators had yet to look at the content of those emails, but based on previous work in the case the agent wrote they had reason to suspect they 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 added, "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 that day.

The FBI hasn't publicly revealed whether it found any evidence of a hacking attempt.

During the presidential campaign, hackers accessed the email accounts of Democratic Party officials and Clinton's campaign chief, John Podesta, and leaked them to the anti-secrecy website WikiLeaks.

Story continues

U.S. intelligence officials have linked the hacking to Russia's intelligence agency and its military intelligence division, although Moscow has denied those accusations.

After getting court consent to delve into the newly discovered emails on Weiner's computer, agents spent several days analyzing them before Comey announced they contained no new evidence of 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.

Los Angeles lawyer E. Randol Schoenberg, who had sued to obtain the court papers, said in a statement 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 the public had a right to see the search warrant application and supporting paperwork. He ordered the redaction of sections of the paperwork related to the investigation into Weiner's online correspondence.

Weiner, who resigned from congress in 2011 after revelations he was sending sexually explicit messages to multiple women, has acknowledged he corresponded with the teenage girl and has apologized for his "terrible judgment."