“If you took away all the things that the press revealed to begin with in the war on terror, you would know virtually nothing about the history of the last 13 years,” he said. He said that the government was less likely to prosecute leaks of classified information that made the government look good, such as the successful mission to kill Osama bin Laden.

“Stay on the Interstate highway of conventional wisdom with your journalism, and you will have no problems,” he said. “Try to get off and challenge basic assumptions, and you will face punishment.”

Mr. Holder, meanwhile, began second-guessing the Justice Department’s tactics. He rewrote the guidelines under which reporters could be subpoenaed. He said the crackdown had, at times, gone too far. And he said he regretted approving documents that labeled a reporter a criminal co-conspirator.

“When you realize your legacy is the guy who tried to put people in jail for holding the government accountable, you can see why you might want to backpedal,” said Gregg Leslie, the legal defense director for the Reporters Committee for Freedom of the Press, which has opposed Mr. Risen’s subpoena.

Mr. Holder pledged not to send reporters to jail, which would normally be the consequence of refusing to testify in a case like Mr. Sterling’s. Then, he indicated that he would not force Mr. Risen to reveal his sources, but would instead force Mr. Risen only to reveal limited information that he had already acknowledged.

More recently, the Justice Department withdrew, at least temporarily, the threat of a subpoena to force Richard Bonin, a CBS News producer, to testify at a terrorism trial in New York. Preet Bharara, the United States attorney in Manhattan, had recommended the subpoena but recently withdrew it, according to lawyers and others involved in the case.

Mr. Holder’s edict in the Sterling case was followed in Monday’s hearing. Prosecutors did not ask Mr. Risen for the information they had sought for years: the identity of his sources, where he met them and what information they provided.