WASHINGTON – The FBI secretly arrested a National Security Agency contractor in recent weeks and is investigating whether he stole and disclosed highly classified computer codes developed to hack into the networks of foreign governments, according to several senior law enforcement and intelligence officials.

Harold Martin, 51, of Glen Burnie, Md., was charged with theft of government property and unauthorized removal and retention of classified materials, authorities said. He was arrested in August after investigators searched his home in Glen Burnie and found documents and digital information stored on various devices that contained highly classified information, authorities said. Officials said the material was recovered from Martin's car and two storage sheds on his property.

The theft raises the embarrassing prospect that for the second time in three years an insider has managed to steal highly damaging secret information from the NSA. In 2013, Edward Snowden, who was also a contractor for the agency, took a vast trove of documents that were later passed to journalists, exposing NSA surveillance programs in the United States and abroad.

The information believed stolen by the contractor — who like Snowden worked for the consulting firm Booz Allen Hamilton, which is responsible for building and operating many of the agency's most sensitive cyberoperations — appears to be different in nature from Snowden's theft.

The same month Martin was arrested, some of the most powerful hacking tools created by the NSA were leaked online.

The contractor is suspected of taking the highly classified "source code" developed by the agency to break into computer systems of adversaries like Russia, China, Iran and North Korea. Two officials said that some of the information the contractor is suspected of taking was dated.

If convicted, Martin would face a maximum of 11 years in prison. The U.S. attorney's office in Maryland said he appeared in court on August 29 and remains detained. The charges against him were unsealed Wednesday.

The Washington Post contributed to this report.