The Justice Department announced Friday that it is revising its rules for obtaining records from the news media in leak investigations, promising that in most instances the government will notify news organizations beforehand of its intention to do so.

The revised procedures are designed to give news organizations an opportunity to challenge any subpoenas or search warrants in federal court.

News organizations are to be informed of an impending document demand unless the attorney general determines that notice would pose “a clear and substantial threat to the integrity of the investigation, risk grave harm to national security or present an imminent risk of death or serious bodily harm,” the new rule says.

The rule emphasizes that members of the Justice Department may apply for a search warrant to obtain a journalist’s materials only when that person is a focus of a criminal probe for conduct outside the scope of ordinary news-gathering.

The regulation follows disclosures that Justice secretly subpoenaed almost two months’ worth of telephone records for 21 phone lines used by reporters and editors for the Associated Press. Separately, the department secretly used a search warrant to obtain some e-mails of a Fox News journalist.

The episodes, which involved leaks of classified material, prompted criticism from lawmakers, the news media and civil liberties groups. President Obama ordered Attorney General Eric H. Holder Jr. to review the Justice Department’s policy for obtaining such material.

The department said its changes are designed to safeguard the essential role of the free press in fostering government accountability and an open society, while protecting national security and law enforcement.

The revisions also ensure more robust oversight of the process by senior department officials and extend policies to cover the use of subpoenas, court orders and search warrants, it added.

Gary Pruitt, the AP’s president and chief executive, said that the news organization is reviewing the new regulations but that the Justice Department appears to be following through on what Holder promised in July.

Jane Kirtley, a University of Minnesota professor of media ethics and the law who speaks often on First Amendment issues, said she was troubled that there remain instances under the new rules in which the government might not notify news organizations of plans to obtain records, such as when it thinks that notice would threaten national security.

The rule says the attorney general may authorize subpoenas to members of the news media when the director of national intelligence certifies the significance of harm from a leak of classified information.

— Associated Press