The administration denied that charge, and the attorney general at the time, Eric H. Holder Jr., appointed two United States attorneys to look into two specific disclosures, one of which was the cyberattack on Iran’s nuclear program.

NBC News reported in 2013 that the Iran cyberattack investigation was focused on General Cartwright.

The cyberattack was Operation Olympic Games, a joint United States-Israeli effort to sabotage Iranian nuclear centrifuges with a computer virus sometimes called Stuxnet. A description of it was contained in “Confront and Conceal,” a book by David E. Sanger, a New York Times reporter, that was also adapted as an article published by The Times.

“In researching his book ‘Confront and Conceal’ and his stories for The New York Times, David E. Sanger relied on multiple sources in Washington, Europe, the Middle East and elsewhere. Most of them spoke on the condition of anonymity,” The Times said in a statement on Monday.

“As in the past, neither The Times nor Mr. Sanger will discuss whether a particular person was a source or the sourcing of particular information that was published, beyond what has been disclosed in our stories and in the book,” the statement continued. “Reporting like this serves a vital public interest: explaining how the United States is using a powerful new technology against its adversaries and the concern that it raises about how similar weapons can be used against the U.S. We will continue to pursue that reporting vigorously.

“We are disappointed that the Justice Department has gone forward with the leak investigation that led to today’s guilty plea by General Cartwright,” it added. “These investigations send a chilling message to all government employees that they should not speak to reporters. The inevitable result is that the American public is deprived of information that it needs to know.”

Prosecutors also accused General Cartwright of lying about his conversations with another reporter, Daniel Klaidman, then of Newsweek. They said that the general had falsely told investigators that he had never discussed an unnamed country with Mr. Klaidman, but that he had sent an email to that reporter that “confirmed certain classified information relating” to that country in February 2012.

Mr. Klaidman wrote an article in February 2012 about the Obama administration’s policy toward disrupting the Iranian nuclear program, including a section about a conversation between General Cartwright and Mr. Obama in early 2009 about various covert sabotage efforts. The list included cyberwarfare programs to damage centrifuges. He declined to comment on Monday.