A US court has jailed New York Times journalist Judith Miller for refusing to testify in an investigation into the unmasking of a CIA agent in 2003.
Both reporters made inquiries about the source of the leak
Miller has argued journalists must be allowed to keep sources confidential in order to preserve freedom of the press.
Time magazine reporter Matthew Cooper, who had also refused to give evidence, said he had received a "dramatic" message, freeing him to testify.
The disclosure of a CIA agent's name can be a federal offence.
Prosecutor Patrick Fitzgerald is investigating who in the Bush administration told the press Valerie Plame - the wife of a former US ambassador who had criticised the president - was a CIA agent.
Ms Plame's husband, Joseph Wilson, had earlier attacked President George W Bush over evidence he had presented to justify the assault on Iraq.
Mr Wilson later alleged that his wife's name was deliberately leaked in revenge.
Mr Fitzgerald had argued last week that both Miller and Cooper, who had looked into the leak, should be jailed for their refusal to reveal their sources.
Miller was ordered on Wednesday to remain in jail until the end of the court investigation in October - or until she decided to testify.
Miller said: "If journalists cannot be trusted to keep confidences, then journalists cannot function and there cannot be a free press."
US journalists have rallied in support of Miller and Cooper
The publisher of the New York Times has said Miller had acted for the "greater good of our democracy" by "honouring her promise of confidentiality to her sources".
Cooper revealed to the court on Wednesday that he had changed his mind at the last minute.
"I went to bed ready to accept the sanctions" for not testifying, he said.
But, he told the judge, he had then received a "somewhat dramatic" message from his source telling him he was free to testify.
Time magazine turned over Cooper's notes and other documents last week, after the Supreme Court refused to consider the case.
Cooper's lawyers had said that this move made his testimony unnecessary - an argument rejected by the prosecutor.
Correspondents say the case is one of the most serious legal clashes between the media and government for decades.
Prosecutor Fitzgerald said "special treatment" for the journalists such as home detention - rather than imprisonment - would "enable, rather than deter, defiance of the court's authority".
"Journalists are not entitled to promise complete confidentiality - no-one in America is," he said.
The leak of Ms Plame's name was not made to Cooper or Miller, but they came to the attention of the prosecutor because of their inquiries.
The reporters refused to co-operate with the investigation, claiming they should not have to reveal their sources because of press freedoms guaranteed in the US Constitution.
That defence was over-ruled by a court in Washington.
The case has sparked concern in the US media about press freedoms and prompted calls for federal shield laws.
A number of states have legislation to protect reporters from having to identify their confidential sources.