LAST WEEK President Obama offered some lofty words about journalism and democracy. Commenting on the unrest in Ferguson, Mo., he declared, “Here, in the United States of America, police should not be bullying or arresting journalists who are just trying to do their jobs and report to the American people on what they see on the ground.”

Mr. Obama has consistently proclaimed his belief in press freedom and its importance in our democracy. But his record undermines his words. The administration has conducted the most far-reaching campaign against leaks in recent memory, with more prosecutions than all previous administrations combined. Perhaps Mr. Obama doesn’t see any conflict here, but we do.

Democracy rests on a delicate balance between secrecy and the public’s need to know about government actions. We’ve long argued that some things must be kept secret, especially in national security, and there are laws and rules for that. But we also believe that, at times, the only way important information reaches the American people is through leaks, and journalists should not be punished for reporting them.

It is well documented that the U.S. government has been excessive in classifying information. No one in Washington is ever prosecuted for needlessly stamping “secret” on a memo or report.

This brings us to the case of James Risen, the New York Times reporter who has been the subject of a long effort by the Justice Department to compel him to testify about the identity of a confidential source used for a chapter in his 2006 book, “State of War.” Prosecutors want Mr. Risen’s testimony in their case against Jeffrey Sterling, a former CIA official who is accused of leaking details of a failed operation against Iran’s nuclear program. Mr. Risen properly has refused to identify his source, at the risk of imprisonment. Such confidential sources are a pillar of how journalists obtain information. If Mr. Risen is forced to reveal the identity of a source, it will damage the ability of journalists to promise confidentiality to sources and to probe government behavior.

New York Times investigative reporter James Risen, who has been threatened with prison for his reporting, listens during an event at the National Press Club August 14, 2014 in Washington, DC. (Brendan Smialowski/AFP/Getty Images)

Mr. Risen’s court appeals have been exhausted. A number of journalists and news organizations, including The Post, have called on the administration to abandon the effort to force Mr. Risen to testify. In recent days, fresh petitions have been presented to the Justice Department, renewing calls to drop the Risen subpoena.

Last year, the Justice Department announced a review of its policies in using law enforcement tools such as subpoenas and court orders to obtain information from the news media. At the time, the department insisted that journalists would “not be subject to prosecution based solely on news gathering activities.” Or as Mr. Obama put it last year, “journalists should not be at legal risk for doing their jobs.” Mr. Risen is at risk. Now is the time to turn these words into deeds.