The Justice Department on Saturday announced that it will no longer use subpoenas or other legal methods to obtain information from journalists about their sources — a major policy shift that came just a day after the New York Times revealed that the department had prohibited the newspaper’s lawyers and executives from disclosing an effort to seize email records of four reporters.

“Going forward, consistent with the President’s direction, this Department of Justice — in a change to its long-standing practice — will not seek compulsory legal process in leak investigations to obtain source information from members of the news media doing their jobs,” Anthony Coley, the department’s top spokesman, said in a statement.

President Biden said on May 21 that he would not allow the Justice Department to seize journalists’ phone and email records, after the department disclosed two instances in which it had tried to do so during Donald Trump’s administration. But the department had not issued a public statement echoing Biden’s decree.

“The Department strongly values a free press, protecting First Amendment values, and is committed to taking all appropriate steps to ensure the independence of journalists,” Coley said.

The Justice Department has been mired in controversy for weeks as it has dripped out disclosures to news outlets, including The Washington Post, of steps taken during the previous administration to try secretly to seize reporters’ phone and email records. Leaders of news outlets and First Amendment advocates had decried the moves, asserting that government attempts to identify reporters’ sources dissuade other officials from talking and revealing important information about taxpayer-funded activities.

“The stories in which these arise are the most important stories that newspapers report,” said Bruce Brown, executive director of the Reporters Committee for Freedom of the Press. “And they’re the most important stories for the public in terms of understanding what its government is doing.”

The controversy seemed to reach a boiling point Friday night, when the New York Times reported that one of its top lawyers had disclosed that he and others had been prohibited by a magistrate judge from revealing a court order to turn over email records.

Although the court’s order and prohibition dated to the Trump administration — when it applied to Google, which operates the Times’s email system — career prosecutors and supervisors in the Biden administration had declined immediately to lift it or to abandon the effort to get records. It was under the Biden administration that a Times lawyer was first notified of what the Justice Department wanted — and simultaneously was commanded not to disclose it.

“It’s completely unprecedented for the Justice Department to seek and obtain a gag order in a leak investigation,” said Theodore J. Boutrous Jr., a lawyer at Gibson Dunn whom the Times brought in to assist with negotiations. “It’s bad enough that the Justice Department was seeking to force disclosure of confidential source information, and it adds insult to injury for the government to seek to muzzle the news organization fighting to protect its sources.”

White House press secretary Jen Psaki said in a statement Saturday that “no one at the White House was aware of the gag order until Friday night,” and she reiterated that “the issuing of subpoenas for the records of reporters in leak investigations” was not consistent with Biden’s recent directive. Prosecutors in Democratic and Republican administrations, though, have done so in the past, and the barring of the practice entirely is likely to upset some career national security lawyers.

“The last 4 years underscored the importance of a free press — but the sensible path is to devise a DOJ policy that strikes a balance between First Amendment interests and the government’s right to protect classified information — not a blanket ban on logical investigative action,” David Laufman, a former Justice Department national security official who supervised leak investigations, wrote on Twitter.

The department revealed in early May that it had, during the Trump administration, secretly obtained the phone records of three current and former Washington Post journalists and had tried to obtain their email records. Later that month, the department made a similar disclosure to CNN, reporting that it had, also during the Trump administration, secretly obtained the phone and email records of the news outlet’s Pentagon correspondent. This month, the department told the New York Times that the Trump Justice Department secretly obtained the phone records of four of its reporters.

In each instance, the department did not seek actual content of phone calls or emails but wanted information such as who called or emailed whom, and when.

The department has not publicly revealed the particular stories at issue. But the eight reporters targeted and the time period in which records were sought — all in 2017 — suggest a broad crackdown.

The Post reporters — Greg Miller, Ellen Nakashima and Adam Entous — wrote a story about classified U.S. intelligence intercepts indicating that in 2016, Sen. Jeff Sessions (R-Ala.) had discussed the Trump campaign with Sergey Kislyak, who was Russia’s ambassador to the United States. Sessions would go on to be Trump’s first attorney general.

CNN’s Pentagon correspondent, Barbara Starr, reported on options the military had prepared to present to Trump on North Korea, U.S. action on a possible planned chemical attack in Syria and a military policy change to suspend the public release of information about American combat deaths in Afghanistan.

The New York Times asserted that the article at issue for its targeted reporters — Matt Apuzzo, Adam Goldman, Eric Lichtblau and Michael S. Schmidt — seemed to be a piece about how James B. Comey, then the FBI director, handled politically charged investigations during the 2016 presidential election.

Coley said in the statement Saturday that the notification to the Times would be the last. “DOJ has now completed a review to determine all instances in which the Department had pending compulsory requests from reporters in leak investigations. All reporters involved have now been notified,” he said.

The Justice Department has provided few details of all the requests but noted that each was issued during the Trump administration. News outlets have called on the department to release more information and have been in talks about a meeting with top Justice Department leaders.

“Secret efforts to obtain journalists’ phone and email records severely hinder the ability of news organizations to uncover information of clear public interest, damaging the First Amendment,” said Washington Post executive editor Sally Buzbee. “We call on the Biden administration and the Department of Justice to provide a full accounting of the chain of events in both administrations and to implement enduring protections to prevent any future recurrence.”

Career officials have defended the moves during the Biden administration, and, in the secret negotiations with the New York Times in recent months, the Justice Department “consistently told us proper procedures were followed,” said David McCraw, a top Times lawyer.

According to court documents, a U.S. magistrate judge approved a request for Times reporters’ email records on Jan. 5 and barred Google from revealing the request to anyone, determining that “there is reason to believe that notification of the existence of this Order will seriously jeopardize the ongoing investigation, including by giving targets an opportunity to destroy or tamper with evidence.”

Google resisted. The Times reported its contract with the company requires the news outlet be told of such moves. And on March 3, a magistrate judge allowed the company to disclose the request to McCraw. The judge decreed that McCraw “may not share the existence or substance of either of these Orders with any other person without further approval from this Court.”

In the weeks that followed, McCraw said, the order was expanded to allow more people to know about it, including Times publisher A.G. Sulzberger, chief executive Meredith Kopit Levien, general counsel Diane Brayton and lawyers from Gibson Dunn. Lawyers representing the Times sought to persuade the Justice Department to lift the gag order and withdraw the request for records, asserting that the department seemed to be running afoul of the Constitution and its own media guidelines.

The department refused to do so for months, including after Merrick Garland was confirmed as attorney general on March 10. On April 6, for example, lawyers for the Times met with four career Justice Department lawyers from the office of the U.S. attorney for D.C. and from the Justice Department’s national security division — Gregg Maisel, Tejpal Chawla, Jay Bratt and Adam Small — a person familiar with the matter said. The Times lawyers tried to persuade those representing the government to abandon their effort, citing the opportunity for a fresh start with the new administration, according to a person familiar with the meeting.

But the career lawyers insisted that the Justice Department had followed proper procedures, the person said, speaking on the condition of anonymity to discuss politically sensitive negotiations.

McCraw told the Times that the Justice Department informed him on Wednesday that it would withdraw its request for records, and on that same day, it revealed to the reporters the seizure of their phone records.

In an email exchange with The Post, McCraw defended his decision to abide by the gag order while he negotiated.

“Unless a gag order is transparently invalid and there is no right of prompt appeal, a party has to comply and appeal or otherwise seek reconsideration before a court; disregarding an order is a basis for contempt,” he said.

New York Times Executive Editor Dean Baquet said in a statement: “I’m comfortable with how the company and David McCraw handled the legal issues. He’s the best in the business.”

Kristine Coratti Kelly, a Washington Post spokeswoman, said that there was no gag order on The Post and that its lawyers were not aware of the effort to obtain its reporters’ phone and email records until the reporters themselves were notified via letters. The Post reporters were told their email records were sought but not obtained.

Coley, the Justice Department spokesman, said the department had moved to postpone enforcement of the order for Times reporters’ email records multiple times in recent months and “voluntarily moved to withdraw the order before any records were produced.”

The Justice Department also announced Saturday that it was backing away from a subpoena of USA Today in a different case not involving reporters’ sources, but readers.

Earlier this year, the department had tried to obtain records associated with people who accessed an article on USA Today’s website about the killing of two FBI agents when they tried to search a Florida apartment. But Gannett, which owns USA Today, fought the request in court, forcing the matter out into public view in recent days.

“Being forced to tell the government who reads what on our websites is a clear violation of the First Amendment,” USA Today publisher Maribel Perez Wadsworth said in a statement Friday. “The FBI’s subpoena asks for private information about the readers of our journalism. We have asked the court to quash the subpoena to protect the important relationship and trust between USA ­TODAY’s readers and our journalists.”

The bureau had initially declined to comment on the matter, but on Saturday, its national press office issued a statement declaring that the subpoena was “being withdrawn because intervening investigative developments have rendered it unnecessary.” The bureau said that the subpoena was issued in connection with an investigation of child exploitation and did not seek communications records of journalists.

Tyler Pager contributed to this report.