A New York Times reporter will be of little assistance to prosecutors as they put a former CIA officer on trial for allegedly leaking classified information about a botched operation in Iran.

Journalist James Risen testified Monday at an unusual pretrial hearing in U.S. District Court in Alexandria, where former CIA officer Jeffrey Sterling goes on trial next week on charges that he illegally leaked national security information to Risen that the journalist used in his 2006 book, "State of War." A chapter in the book details an apparently botched plan to provide Iran with flawed nuclear blueprints through a Russian intermediary.

For at least six years, Risen has been resisting prosecutors' efforts to compel his testimony, saying he has an obligation to protect the confidentiality of his sources. Ultimately, a federal appeals court ruled that Risen must testify and that he had no special privilege as a journalist to quash the subpoena.

Monday's hearing was designed to hammer out ahead of trial exactly what Risen would be willing to answer, and exactly what would be asked of him. The Justice Department, under pressure from free-press advocates, had previously said it would not try to press Risen on whether Sterling was his confidential source, and would limit its questions.

Still, at the outset of Monday's hearing — which marked Risen's first actual court appearance in the case despite years of legal wrangling — it appeared Risen was unwilling to answer anything but the most basic questions.

Wearing a pained expression through much of his testimony, Risen acknowledged that he had written certain newspaper articles and "State of War," and that he had used unnamed sources. But when he was asked whether he had confidentiality agreements with unnamed sources, he refused to answer, even though he had admitted as much in affidavits he had previously sworn out.

"I decline to answer the question. I don't want to provide information that I believe the government wants to use as a building block ... in this case," Risen said.

Eventually, after Risen consulted with his lawyers, he confirmed that he promised confidentiality to certain sources. He also reiterated to prosecutors that he would not under any circumstances testify about the identity of his sources, or what information came from confidential sources.

Risen was somewhat more cooperative when defense lawyers cross-examined him. Risen acknowledged under cross-examination that, in previous affidavits, he said he made a conscious decision to publish the material in "State of War" because he felt the public had the right to know about a botched intelligence operation, drawing the parallel that bad intelligence about weapons of mass destruction in Iraq had led the country into war.

That admission is important to defense attorneys because they argue that, under the law and the government's theory of the case, Risen is just as guilty of exposing government secrets as Sterling. Defense lawyers are still seeking to have the case dismissed on the basis of selective prosecution.

After Risen completed his testimony, defense lawyer Edward MacMahon said the case against Sterling, of O'Fallon, Missouri, should be dismissed because Risen's unwillingness to testify in any detail leaves the government unable to prove key elements of the crime, including venue. Specifically, prosecutors must prove that the crimes occurred in the Eastern District of Virginia. Usually this is a formality, but MacMahon suggested it will prove difficult without Risen's testimony, even though CIA headquarters are in the district, as is Sterling's former home in Sterling, Virginia.

It is not entirely clear how Risen's stance affects the government's case. The government possesses email and phone records that show extensive contact between Sterling and Risen. Brinkema has previously suggested the government could rely on those records to establish what it needs without compelling Risen's testimony.

Brinkema said it will now be up to prosecutors whether they want to call Risen as a witness next week in front of a jury. If he is called, the expectation is that he won't be asked any questions other than those that were asked on Monday, and he would be expected to give the same answers.