New York Times reporter James Risen does not have to reveal his source of information about a Central Intelligence Agency (C.I.A.) effort to sabotage Iran’s nuclear program at the end of the Clinton administration, a federal judge has ruled.

U.S. District Judge Leonie Brinkema on Friday partially granted Risen’s request to quash a government subpoena that would have required him to disclose the confidential source next month when he testifies at the trial of former C.I.A. officer Jeffrey Sterling.

The government alleges that Sterling provided Risen classified information that appeared in Risen’s 2006 book, “State of War: The Secret History of the C.I.A. and the Bush Administration.” Sterling faces criminal charges as part of an Obama administration crackdown on officials accused of disclosing restricted information to journalists.

Risen must still appear to testify at trial, but Brinkema limited his testimony to confirming “that he wrote a particular newspaper article or chapter of a book”, and that what he wrote was accurate. He must also confirm that statements he referred to as being from an unnamed source were in fact made to him by an unnamed source, and that any statements he wrote as having been made to him by an identified source were made by that source.

Federal prosecutors could still appeal the decision, but the journalist told the New York Times that it was “an important victory for the First Amendment and for freedom of the press”, adding: “The protection of sources will allow for the American press to continue to find and report the truth.”

According to The New York Times, civilian and military prosecutors have charged five people in cases involving leaking information since President Obama took office, more than all previous presidents combined.

Two of those cases – the case against Stirling and a case against former National Security Agency official Thomas Drake, who faced felony charges for providing classified information to The Baltimore Sun about cost overruns and mismanagement at the agency – began under the Bush administration.

Drake pleaded guilty in June to a misdemeanour charge of exceeding authorized use of a computer and was sentenced to a year of probation after the government’s case against him collapsed. A federal judge at the time criticized the government’s conduct, calling delays in the case “unconscionable” and likening the treatment of Drake to British tyranny in the colonial era.

Cases brought under the Obama administration include charges against a former Federal Bureau of Intelligence translator who pleaded guilty to leaking classified documents to a blogger, and the case against former soldier Bradley Manning, who allegedly leaked a massive trove of classified documents to WikiLeaks.

The cases have highlighted the need for the United States to adopt a federal shield law for reporters. Many individual states in the United States have shield laws, but they vary by degree from state to state depending on the proceedings involved.