A Louisiana private investigator tried to exploit a loophole in an online student financial aid tool to illegally obtain Donald Trump’s tax records during last year’s presidential campaign, federal prosecutors allege in court records.

Jordan Hamlett, 31, was unsuccessful in his attempts to get Trump’s tax information and has been charged with false impersonation of a Social Security number.

Hamlett allegedly tried to get Trump’s tax records on Sept. 13, according to records filed in U.S. District Court in the Middle District of Louisiana — two months before the Republican businessman won the presidency in a stunning upset. Trump refused to share his tax returns during the campaign, contrary to the standard practice of presidents and major-party presidential nominees for the past four decades, and he has shown no sign that he intends to release them as president.

The website Hamlett allegedly attempted to exploit allowed students filling out the Free Application for Federal Student Aid — the form that colleges and the government use to determine grants and loans — to upload tax information by submitting a Social Security number and other data.

The data-retrieval tool, an initiative of the U.S. Education Department and the Internal Revenue Service, was designed to make financial aid applications simpler for millions of students. But the government shut it down in March amid security concerns.

Someone pretending to be a student could start the financial aid process, provide a false Social Security number and give permission for the IRS to automatically populate the FAFSA form with tax information.

[Identity thieves may have hacked files of up to 100,000 financial aid applicants]

According to a federal indictment dated Nov. 10, Hamlett is accused of using a Social Security number that was not his. The number ended in four digits that hackers have claimed correspond to Trump’s.

During an October 2016 interview with law enforcement agents in a public atrium at the Embassy Suites in Baton Rouge, Hamlett “immediately volunteered that he had committed the crime,” according to a motion that a federal prosecutor filed last week. “He even sounded proud of what he had done.”

Hamlett has asked the court to prohibit his statements during that interview from being used as evidence, arguing that he was never advised of his Miranda rights and didn’t have a lawyer present. Prosecutors object, arguing that Hamlett spoke voluntarily, was never in custody and therefore had no right to a Miranda warning.

Hamlett has worked as a private investigator for nine years, according to court records, and has been released from custody under a set of conditions — including that he not use any Internet-connected devices until the court decides otherwise.

He did not immediately return a phone call seeking comment Monday afternoon. His lawyer, Michael Fiser, said he could not speak to the specifics of Hamlett’s case while he is under indictment.

“Mr. Hamlett does maintain that he intended to commit no crime, and he looks forward to presenting all the facts to a jury regarding what he actually did and why he did it,” Fiser wrote in an email.

The accusations against Hamlett were first reported by the publication Diverse Issues in Higher Education.

IRS Commissioner John Koskinen told Congress this spring that hackers may have exploited the FAFSA website to steal information from up to 100,000 taxpayers — and that identity thieves had used the information to file thousands of fraudulent tax returns.

Koskinen also told Congress that security concerns about the data-retrieval tool had first emerged in September — the same month Hamlett allegedly tried to access Trump’s records. But federal officials decided to monitor the site rather than shutting it down immediately, as they didn’t want to disrupt the financial aid application process for millions of students.

Read the court documents:

Indictment of Jordan Hamlett

Hamlett’s motion to suppress his statements

Prosecutors say Hamlett admitted to allegations