But perhaps the most damaging leak of all was discovered around the time of Mr. Martin’s arrest in August 2016, when a mysterious group calling itself the Shadow Brokers announced an online auction of a long list of software exploits the N.S.A. used to break into foreign computer networks. The Shadow Brokers eventually made the stolen cyberweapons public, and other countries and criminal groups began using them for hacking and theft around the world.

F.B.I. investigators focused on Mr. Martin after getting a tip from Kaspersky Lab, a Russian cybersecurity company. Two Kaspersky employees had gotten cryptic messages from Mr. Martin — calling himself “HAL999999999” — via Twitter that seemed to be offering secrets, as Politico first reported in January. The assistance was a bit ironic, because American intelligence officials have sometimes accused Kaspersky of being too close to Russian intelligence, charges the company denies.

“Shelf life, three weeks,” Mr. Martin wrote in one of his cryptic texts, seeming to suggest that he was offering material on a time-limited basis. But shortly after sending the messages, he blocked on Twitter the two Kaspersky employees he had just contacted, so they could not respond.

The F.B.I. quickly linked the HAL999999999 Twitter account to Mr. Martin, and agents were soon searching his modest house in Glen Burnie, a Baltimore suburb. They discovered a staggering total of 50 terabytes of government data, a virtual library’s worth, much of it classified at a high level.

Investigators at first believed Mr. Martin might be the Shadow Brokers, who had posted their first announcement of their auction of N.S.A. hacking tools a half-hour after Mr. Martin blocked the two Kaspersky workers on Twitter. They found the same N.S.A. exploits in Mr. Martin’s vast collection of stolen material.

But the Shadow Brokers continued to post taunting manifestoes and stolen software for months after Mr. Martin was jailed. It appears that the investigators eventually concluded that Mr. Martin was not the source of the Shadow Brokers’ material, at least not wittingly.

Government officials have never charged anyone in the Shadow Brokers breach, and speculation has centered on two possible perpetrators: Russian intelligence or disgruntled N.S.A. insiders. If F.B.I. and N.S.A. security officers have made progress in solving the case, they have not said anything about it in public.

According to court filings, Mr. Martin first agreed to plead guilty in January 2018. But negotiations subsequently fell apart, and the plea came more than a year after it was first expected. Mr. Martin has been incarcerated since his arrest, and the two and a half years he has served will be counted toward his sentence.