A former contractor for the National Security Agency was sentenced to nine years in federal prison with three years of supervised release Friday, a result of a plea deal for stealing troves of classified government documents over two decades and keeping them at his home in Maryland.

Harold T. Martin, 54, who was arrested by the FBI in August 2016, originally pleaded not guilty to 20 counts of willful retention of national defense information that prosecutors said he hoarded in his home and car, but then changed his plea to guilty on one felony count. His sentence "is one of the longest ever imposed in this type of case," U.S. District Attorney for Maryland, Robert K. Hurshould, said in a statement on Friday.

FILE - In this Oct. 5, 2016 file photo, the house of Harold Thomas Martin III is seen in Glen Burnie, Md.  (AP Photo/Jose Luis Magana)

Hurshould said that the harsh punishment should "serve as a warning that we will find and prosecute government employees and contractors who flagrantly violate their duty to protect classified materials.”

There was no suggestion he passed any of the information on to other countries.

FORMER NSA CONTRACTOR PLEADS GUILTY IN THEFT OF CLASSIFIED DOCUMENTS

Martin, who was employed by at least seven different private companies and assigned as a contractor to various government agencies for over 23 years, had maintained high levels of security clearance, according to his plea deal. He held clearance to access and handle both Top Secret and Sensitive Compartmented Information (SCI) throughout his tenure and was able to access government computer systems, programs, and information in secure locations, including classified national defense information, which he compromised by keeping them in his personal possession.

Prosecutors noted that Martin's actions forced the government to change and abandon national security programs that were contained in the documents and "harmed Intelligence Community sources and methods," Special Agent in Charge Jennifer C. Boone, at the FBI Baltimore Field Office said in a statement Friday.

CLICK HERE FOR THE FOX NEWS APP

Martin's defense team argued in a March court appearance that their client, a former Navy lieutenant, had no intention to harm his country or the intelligence agencies he served but instead said he was a "compulsive hoarder" who took work documents home with him as a result of his ADHD, for which he took medication.

"His actions were the product of mental illness. Not treason," his lawyers said in a statement at that time.

“Instead of respecting the trust given to him by the American people, Martin violated that trust and put our nation’s security at risk.  This sentence will hold Mr. Martin accountable for his dangerous and unlawful actions,” Assistant Attorney General for National Security John Demers said Friday.