Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A Maryland man who worked as a contractor for the NSA has been arrested for allegedly stealing classified material that was later found in his home and car, U.S. officials said Wednesday.

Navy veteran Harold Thomas Martin III, who had a top secret national security clearance, was arrested on Aug. 27 and is still in custody, according to the Justice Department. His attorneys said there is no evidence he "intended to betray his country."

Hal Martin

Martin, 51, was employed by Booz Allen Hamilton, the same firm where NSA leaker Edward Snowden was a contractor when he took a huge cache of classified documents and fled the United States in 2013. Martin was also enrolled as an information systems graduate student at the University of Maryland Baltimore County, spokeswoman Dinah Winnick confirmed.

The FBI learned about the insider breach in mid-August, when a group calling itself The Shadow Brokers offered to sell NSA hacking tools and other secrets for $500 million, officials told NBC News. Martin and The Shadow Brokers had some of the same materials, according to officials.

The FBI is investigating whether there is a link between Martin and The Shadow Brokers, and any connection between Martin and NSA hacking tools that were put up for sale by the Shadow Brokers, a senior official said. No link has yet been found.

The National Security Agency (NSA) headquarters in Fort Meade, Maryland. Handout / Getty Images

A federal criminal complaint unsealed Wednesday said a search of Martin's home and car turned up a trove of documents and digital files — a "large percentage" of them with highly classified information, some labeled Top Secret of Sensitive Compartmented Information.

"We take that type of conduct very seriously," Assistant Attorney General John Carlin said at the CNBC Cambridge Cyber Summit, declining to discuss any motive for the theft.

"When you are a government employee you swear an oath to protect the information, knowing the damage revealing sources and methods can do to our ability to protect ourselves against foreign threats."

Get breaking news and insider analysis on the rapidly changing world of media and technology right to your inbox. This site is protected by recaptcha

The criminal complaint said that among the classified material found in Martin's home and car, six documents were obtained from sensitive intelligence and appear to date to 2014 — six months after the NSA was rocked by Snowden's leaks.

"These documents were produced through sensitive government sources, methods and capabilities, which are critical to a wide variety of national security issues," the complaint said. "The disclosure of the documents would reveal those sensitive sources, methods and capabilities."

Martin submitted to an interview after the materials were seized — at first denying he took the documents and files and later admitting it when confronted with specific documents, the complaint said.

"Martin states that he knew what he had done was wrong and that he should not have done it because he knew it was unauthorized," the complaint said.

Martin's attorneys, Jim Wyda and Deborah Boardman, said in a statement that there is no evidence their client is a traitor.

“What we do know is that Hal Martin loves his family and his country. He served his nation honorably in the U.S. Navy as a lieutenant and he has devoted his entire career to protecting his country," they said.

This is huge. Did the FBI secretly arrest the person behind the reports NSA sat on huge flaws in US products? https://t.co/otgOwB5efm — Edward Snowden (@Snowden) October 5, 2016

A neighbor of Martin said he was shocked when teams of law-enforcement officials in camouflage and wielding rifles descended on the working-class Baltimore suburb in August and hauled away garbage bags full of material.

"I thought World War III had started," the neighbor, Murray Bennett, said.

He said Martin, who is divorced, had lived next door for more than a decade. He drove an old Chevy and "was a decent sort — or seemed like it."

"We would pass out Halloween candy together," Bennett said. "Now Halloween is coming out and I guess I won't have anyone to hand out candy with."

The U.S. Navy confirmed that Martin served from 1987 to 2000, achieving the rank of lieutenant. Booz Allen did not say how long Martin had worked there but said he was fired after the arrest and that it is cooperating with authorities.

Martin was arrested for Driving Under the Influence in Maryland in 2006. He was put on probation and ordered to pay a fine.

He and his wife divorced in 2010, according to court records. She now lives out of state.

The complaint did not spell out how investigators came to suspect Martin. After the Snowden affair, the NSA installed a host of new tools designed to monitor employee behavior on its networks, but it's unclear if those played a role in this case.

Am I correct in reading they didn't charge him under the Espionage Act? Under this administration, that's a noteworthy absence. — Edward Snowden (@Snowden) October 5, 2016

At the Cyber Summit, Carlin declined to say how long investigators believe the theft had been going on.

"I don’t think we can ever be satisfied with [our security measures]," he said. "We need to learn from each experience about how we can best protect [our systems]."

One former senior U.S. cybersecurity officials said he had heard talk of an urgent investigation into the theft of NSA documents.

"We’d heard for weeks that there was another insider at the NSA, a Snowden–like character,’’ said the former official, who spoke on the condition of anonymity because of his ongoing security contracting work.

"I don’t think anyone has any idea yet how much damage has been done. They will do a complete evaluation of what he had access to,” said the former official.