In September 2016, as the heated presidential election between Hillary Clinton and Donald Trump swung into a final phase, a Louisiana private investigator repeatedly attempted to access the Republican candidate’s tax returns.

According to court documents, Jordan Hamlett used Trump’s Social Security number to apply for federal student aid in hopes of gaining access to the candidate’s tax records. But the breach was detected by federal authorities.

Investigators confronted the 32-year-old Lafayette resident before the November election. At the time, they were unsure whether he was working with hackers or even if Hamlett had discovered the returns — a potential game-changer for the election, according to court records.

Hamlett pleaded guilty in U.S. district court to a charge of misuse of a Social Security number. He faces five years in prison and a $250,000 fine.

According to a plea agreement filed in federal court, Hamlett was unable to access the tax records, a hotly contested issue during the election after Trump declined to release the information, unlike most major party candidates over the past several decades.

Donald Trump defended his decision not to release his tax returns, saying the American people "don’t care at all." (The Washington Post)

Hamlett’s attorney, Michael Fiser, has maintained Hamlett only attempted to access the records “out of sheer curiosity,” the Associated Press reported. Before changing his plea, the defendant had argued in court documents he was simply acting as a “white hat” hacker testing the federal system for vulnerabilities.

“We felt like, under the circumstances, it was time to accept full responsibility and move forward to get closure,” Fiser told the AP after Monday’s guilty plea.

According to the plea agreement, on Sept. 13, Hamlett created an application on the U.S. Department of Education’s Free Application for Federal Student Aid website using Trump’s Social Security number and other information. Part of the process of applying for the financial student aid involved accessing tax records through an Internal Revenue Service Data Retrieval Tool.

“After obtaining the FSA ID, the defendant, using the IRS Data Retrieval Tool, unlawfully attempted to obtain the presidential candidate’s federal tax information from the Internal Revenue Service,” the plea agreement stated. “The defendant made six separate attempts to obtain the federal tax information from IRS servers, but he was unsuccessful.”

Hamlett and his attorneys argued in motions to the court that he was only trying to see if he had discovered a potential crack in the system. In a court filing from earlier this year, his attorney noted Hamlett previously had discovered a flaw in the Livingston Parish Sheriff’s Office website allowing public access to open investigation reports. “Hamlet tipped the Sheriff’s Office to the flaw and was met with thanks and appreciation, not an arrest,” his attorney wrote in a court filing.

On the day he attempted to access Trump’s details, Hamlett claimed he tried to call the IRS to alert them to the student aid application shortcut. “Hamlett abandoned the attempt to notify the IRS when he could not reach a human, only recorded messages,” his attorney wrote.

Federal investigators, however, learned about the potential breach.

At a court hearing in March, Treasury Department Special Agent Samuel Johnson testified investigators were particularly worried Hamlett might be working with Anonymous, the global hacker collective who had promised to release Trump’s tax returns.

“There was thoughts this could be something that would affect the election if the information had been received,” Johnson told the court, according to a transcript of the hearing. “We also were not aware of whether he was working with somebody, or if somebody had hired him to attempt to access President Trump’s tax returns for release, or if he had done it, and he had a plan to sell the information out and distribute the information for some type of purpose.”

On Oct. 27, investigators set up an undercover operation to confront Hamlett. An agent contacted the private investigator posing as a potential client. The two arranged a meeting at a hotel, where investigators then approached Hamlett about accessing the material.

“We advised him that someone had a genius idea to attempt to access President Trump’s tax returns through the financial aid website,” Johnson testified. “At that point, Mr. Hamlett acknowledged that it was him. He was in agreement that it was a genius idea to attempt to get Mr. Trump’s returns through that site.”

Hamlett’s sentencing hearing has yet to be scheduled.

More from Morning Mix: