A former Energy Department employee has been indicted on charges of attempting to infiltrate the agency’s computer system to steal nuclear secrets and sell them to a foreign government, U.S. officials said.

Charles Harvey Eccleston, a former employee at the department and at the independent Nuclear Regulatory Commission (NRC), was arrested after an undercover FBI operation.

The sting was launched after Eccleston offered to provide to a foreign government classified information he that claimed could be obtained from the Energy Department, according to the indictment.

Eccleston, 62, a U.S. citizen who had been living in the Philippines since 2011, was “terminated” from his job at the NRC the previous year, according to a statement from the Justice Department. In January, the statement said, he targeted more than 80 Energy Department employees with e-mails containing malicious software that, if activated, could damage computers and extract sensitive information.

The FBI determined that no computer virus or malicious code was transferred into government computers.

“This former federal employee is charged with trying to launch a cyberattack to steal sensitive information from the Department of Energy,” Vincent H. Cohen Jr., acting U.S. attorney for the District of Columbia, said in the statement.

Eccleston was detained by Philippine authorities in Manila on March 27 and deported to the United States to face criminal charges.

“As alleged in the indictment, Eccleston sought to compromise, exploit and damage U.S. government computer systems that contained sensitive nuclear-weapon-related information with the intent to allow foreign nations to gain access to that material,” said John Carlin, assistant attorney general for national security.

According to an affidavit, the FBI’s sting involved undercover employees posing as representatives of the unnamed foreign country. In exchange for future payment, Eccleston offered to design and send Energy Department employees “spear-phishing” e-mails that contained malware that could be used to extract the classified information, officials said.

He was communicating with “a person he believed to be a representative of a foreign government,” according to the indictment.

In 2013, Eccleston told an FBI undercover employee that he had tried to sell information to China and Venezuela “but was not granted access to officials of these countries,” according an FBI agent’s affidavit that was unsealed in connection with the case.

Eccleston was charged with three counts of unauthorized access to a computer and one count of wire fraud. If convicted on all counts, he could face a maximum of 50 years in prison.

He made his initial court appearance Friday in U.S. District Court for the District of Columbia, where a magistrate ordered that he remain detained pending a hearing set for May 20. He was represented by Carlos Vanegas from the office of the Federal Public Defender for the District of Columbia. That office declined to comment.

Eccleston had been critical of the NRC’s environmental review policy, according to e-mails and other documents that he wrote and that were posted on the agency’s Web site. In one 2013 e-mail to the NRC chairwoman, he said one of his books “exposes NRC’s deceptive and tainted license renewal process.”

He left the agency in 2010 after he failed to meet the requirements of a two-year probationary period, according to individuals familiar with the matter.

Spencer Hsu contributed to this report.