Updated

A Minnesota judge on Thursday sentenced a former FBI agent to four years behind bars after the man reportedly confessed to giving classified defense documents to a reporter.

U.S. District Judge Wilhelmina Wright told Terry James Albury, 39, who pleaded guilty earlier this year, that he “knowingly” committed the crime despite its illegality, according to The Associated Press.

“You did so willingly. You knew that what you did was a criminal act, and you knew that you were putting the nation's security at risk,” the judge told Albury.

The 4-year prison term matches the seriousness of the crime, Wright said, and should serve as a deterrent to others.

Prosecutors labeled Albury’s actions a betrayal of the public’s trust when he stole more than 70 documents, dozens of which were considered classified, The Associated Press reported. A “secret” document pertaining to how the bureau assesses confidential informants was reportedly among the records he provided to an online news organization.

ACCUSED TREASURY LEAKER HAD ‘CO-CONSPIRATOR’ IN PLOT TO SPILL DIRT ON TRUMP OFFICIALS: COURT FILES

He pleaded guilty in April to one count each of unauthorized disclosure of national defense information and unauthorized retention of national defense information.

Prior to sentencing, Albury reportedly expressed remorse for his actions.

“I sincerely wanted to make a difference and never meant to put anyone in danger,” he said, according to a tweet from KSTP reporter Ryan Raiche.

Defense attorneys for Albury reportedly requested he be given probation, maintaining that he acted patriotically and was morally conflicted by the FBI's counterterrorism policies that he viewed as racial profiling.

SENATE INTELLIGENCE STAFFER WHO DATED REPORTER PLEADS GUILTY TO LYING TO FBI ABOUT LEAKS

The Justice Department is “conducting perhaps the most aggressive campaign against leaks in Department history,” Attorney General Jeff Sessions said in a news release announcing Albury’s sentencing.

“Crimes like the one committed by the defendant in this case will not be tolerated—they will be prosecuted to the fullest extent of the law and punished,” Sessions said.

FBI Director Christopher Wray also weighed in, saying Albury’s actions were adverse to his duty as an FBI agent.

“Every FBI agent has a solemn obligation to protect classified information from unauthorized disclosure to safeguard our national security. Terry Albury betrayed that responsibility, and he betrayed the trust bestowed on him by the American people,” Wray said in the statement.

Fox News’ Jake Gibson and The Associated Press contributed to this report.