An aerial view of the National Security Agency headquarters in Fort Meade, Md., in January 2010. (Larry Downing/Reuters)

Federal prosecutors in Baltimore are expected to seek an indictment as early as this week against a former National Security Agency contractor who is accused of carrying out the biggest theft of classified information in U.S. history.

The indictment against Harold T. Martin III is expected to contain charges of violating the Espionage Act by “willfully” retaining information that relates to the national defense, including classified data such as NSA hacking tools and operational plans against “a known enemy” of the United States, according to individuals familiar with the case.

Martin, 52, was arrested Aug. 29 at his home in Glen Burnie, Md., and he has been held in a detention facility since. A U.S. District Judge last fall declined Martin’s request to be released from jail pending an eventual trial or resolution of the case, ruling that he was a flight risk.

In a complaint unsealed in October, the government charged Martin with felony theft of government property and the unauthorized removal and retention of classified materials, a misdemeanor. The prosecutors said then that they expected that the indictment would also include charges of violations of the Espionage Act, offenses that carry a prison term of up to 10 years for each count.

Such charges, prosecutors said, if run consecutively, could amount to a sentence as high as 30 years to life in prison.

The Justice Department declined to comment Monday.

In court hearings and filings, prosecutors have characterized Martin’s actions as highly damaging to national security. Over the course of 20 years working with various federal agencies, Martin took “irreplaceable classified material on a breathtaking scale,” said Zachary A. Myers, an assistant U.S. attorney with the District of Maryland, at a detention hearing in October.

Myers said Martin took “many thousands of pages” of classified material as well as 50 terabytes of digital data, much of which has “special handling caveats.”

Martin previously worked in the Navy, leaving active duty in 1992 and then held a variety of tech jobs with government contractors. He worked at the NSA from 2012 to 2015, where he was an employee of the intelligence contractor Booz Allen Hamilton.

For some portion of that time, Martin was in the NSA’s elite hacker unit, Tailored Access Operations, which makes and deploys software used to penetrate foreign targets’ computer networks for foreign espionage purposes.

Some U.S. officials said that Martin allegedly made off with more than 75 percent of TAO’s library of hacking tools — an allegation which, if true, would be a stunning breach of security.

James Wyda, one of Martin’s defense attorneys, declined to comment.

His attorneys have previously portrayed him as a patriot who took material home to become better in his job, not to pass them to a foreign spy agency and betray his country. The desire to improve became a compulsion, Wyda argued at the detention hearing.

“This is the behavior of a compulsive hoarder who could not stop gathering and possessing the documents he treasured,” Wyda said.

Martin’s theft was discovered more than a year after another breach at TAO, in which a longtime employee was discovered to have taken without authorization significant quantities of the unit’s hacking tools. The breach was not thought to be as serious as Martin’s, but it caused concern within the intelligence community.