Outgoing U.S. Attorney General Eric Holder will not compel New York Times reporter James Risen to provide the identity of a confidential CIA source, a senior Justice Department official told NBC News Friday.

Holder’s decision is the culmination of a two-year battle between Risen and the Obama administration, which could have prosecuted the journalist if he made good on a promise to not turn over the name of a CIA officer who provided information about a failed U.S. intelligence operation in Iran.

Risen was scheduled to testify in the trial of former CIA officer Jeffrey Alexander, who has been charged with violating the Espionage act for allegedly providing Risen with information about the CIA’s Operation Merlin. The plan, which began under the Clinton administration before being carried out by the Bush administration, included convincing a defected Russian scientist to intentionally provide the Iranian government with a flawed nuclear plan. Risen first revealed the plan in a chapter of his 2006 book, “State of War.”

Sterling’s trial has been long delayed as federal prosecutors debated whether Risen, as a journalist, should be forced to testify about his dealings with confidential sources. Risen has promised on multiple occasions that if he were subpoenaed, he would sooner go to prison than provide any meaningful testimony on the witness stand.

“I believe that you cannot have aggressive investigative reporting without receiving confidential information and classified information in order to understand what the U.S. government is doing,” Risen told NPR’s Fresh Air. “If we didn’t have an aggressive press investigating national security and the War on Terror we would have been fighting a war for 13 years and know virtually nothing about that was going on. To me this is a bed rock thing for me to do in order to continue pursuing my career.”

Refusing to comply with a subpoena could have led to a separate prosecution and ultimately jail time for Risen.

The New York Times, reporting on the legal wrangling, called the Risen case “the most serious confrontation between the government and the press in recent history.”

Holder has said repeatedly that he does not intend to imprison a reporter for contempt of court if that reporter refused to testify about an anonymous source.