A federal appeals court has delivered a blow to investigative journalism in America by ruling that reporters have no first amendment protection that would safeguard the confidentiality of their sources in the event of a criminal trial.

In a two-to-one ruling from the fourth circuit appeals court in Richmond, Virginia, two judges ruled that a New York Times reporter, James Risen, must give evidence at the criminal trial of a former CIA agent who is being prosecuted for unauthorised leaking of state secrets.

The ruling, written by chief judge William Traxler, states in stark terms that even when a reporter has promised confidentiality to a source, "there is no first amendment testimonial privilege, absolute or qualified, that protects a reporter from being compelled to testify … in criminal proceedings".

The ruling comes at a time of increasing tension between news organisations and the US government in the context of an unparalleled clamp down by the Obama administration on official leakers. Jeffrey Sterling, the former CIA employee in whose trial Risen must now testify or face possible jail time, is the seventh former government employee to face prosecution under the stringent Espionage Act since Obama took office, alongside former NSA contractor Edward Snowden and Bradley Manning, currently on trial for passing documents to WikiLeaks.

David Kelley, a member of Risen's legal team, said he were looking at the options in the light of today's ruling. He added that the Department of Justice had revised its guidelines since the appeal court came to its opinion – and he hoped that would influence what the prosecution in the Sterling case did next.

The timing of the appeal court ruling is ironic as it comes just days after the new Justice Department guidelines were published. Those guidelines were drawn up at the request of President Obama following the controversy over surveillance of the phone lines of Associated Press.

They emphasised that the Obama administration wished to strike "the appropriate balance between two vital interests: protecting the American people by pursuing those who violate their oaths through unlawful disclosures of information and safeguarding the essential role of a free press in fostering government accountability in an open society."

Only hours before the appeal court issued its harsh judgment, Risen's lawyers filed a letter to the court urging the judges to take on board the new DoJ guidelines as evidence of the government's desire to recognise a federal common law privilege for reporters.

Senior journalists and media experts reacted with disappointment to the appeal court ruling, which overturned an earlier district court judgement that had granted Risen protection against being forced to testify about his source. The matter relates to Risen's 2006 book, State of War, that included a passage on CIA efforts to foil Iranian nuclear ambitions for which Sterling was accused of having been the source four years later.

Stephen Engelberg, the editor-in-chief of the investigative website ProPublica, said the ruling was "extremely unfortunate given the criminalisation under this government of officials talking to reporters". He said it underlined the need for a federal shield law that would extend protections to journalists in line with similar safeguards that already exist in many states.

Lucy Dalglish, co-chair of the First Amendment Committee of the American Society of News Editors, said the decision would add to the chill that was rapidly taking hold in America as a result of the aggressive pursuit of leakers by the Obama administration. "It has really got bad, and not just in national security reporting. Every official now knows that if they talk to a reporter they are potentially in a world of hurt."

Risen has said in previous comments that he will rather go to prison than reveal the identity of his source. Were that to happen, he would join a small club of reporters jailed for contempt of court for refusing to testify that notably includes Judith Miller, the former New York Times journalist who spent two months in prison in 2005.

Lowell Bergman, professor of investigative reporting at UC Berkeley, said the appeal court ruling "underscores the danger that we now face as a society when prosecutors are told that they can use journalists to gather evidence against potential and active defendants".

The Freedom of the Press Foundation, which is campaigning to introduce greater access to information in the prosecution of Bradley Manning, pointed out that the Fourth Circuit appeals court covered many of the largest government agencies dealing with national security, including the NSA. "This is the worst reporter's privilege decision in recent memory, and if it stands, will have significant consequences for press freedom in the United States," said the foundation's Trevor Timm.

In a dissenting opinion, the third judge on the panel, Roger Gregory, made a robust argument for protecting the privileges of journalists seeking to keep the identity of their sources confidential. "A free and vigorous press is an indispensable part of a system of democratic government," he wrote. "Public debate on American military and intelligence methods is a critical element of public oversight of our government."