The cable news network CNN revealed Wednesday that it waged a secret court battle with the Trump administration over a Justice Department demand for one of its reporter’s email records — and ultimately agreed early in President Biden’s tenure to turn over a “limited” set of materials.

The network’s disclosure Wednesday shed new light on federal prosecutors’ use of heavy-handed and controversial tactics to figure out who was disclosing classified information to journalists.

According to CNN, its own lawyer was bound by a court order preventing him from sharing with anyone except the network’s president, top attorneys at CNN’s corporate parent and attorneys at an outside law firm any details about the Justice Department’s request and the ensuing court battle.

In recent weeks, the agency disclosed to CNN, The Washington Post and the New York Times that it had — during the Trump administration — made secret attempts to seize phone and email records of the news outlets’ reporters, apparently related to stories they had written in 2017. Media executives and First Amendment advocates decried the moves, asserting that such tactics could damage reporters’ ability to learn and report essential information about government activities.

Biden subsequently declared publicly he would not allow the Justice Department to seek journalists’ phone and email records, and the department has repeatedly confirmed it would follow the directive. Kristine Coratti Kelly, a Washington Post spokeswoman, said representatives from The Post, the Times and CNN are scheduled to meet Monday with Attorney General Merrick Garland “to understand what happened and discuss policy changes to prevent a recurrence.”

Asked about the matter by Sen. Jeanne Shaheen (D-N.H.) at a congressional hearing Wednesday, Garland said, “Going forward, we have adopted a policy which is the most protective of journalists’ ability to do their jobs in history, and it is, as you described, that we will not use compulsory process in leak investigations to require reporters to provide information about their sources when they are doing their job as reporters.”

Garland said he would issue a memo formalizing the policy, though he noted that officials would have to distinguish between reporters doing their jobs and those committing crimes “unrelated to the leaking.”

CNN revealed last month that the Justice Department told Pentagon correspondent Barbara Starr, in a May 13 letter, that it had obtained her phone and email records for the two-month period between June 1 and July 31, 2017. The network’s president, Jeff Zucker, issued a statement at the time saying, “CNN strongly condemns the secret collection of any aspect of a journalist’s correspondence, which is clearly protected by the First Amendment.”

The government has said it did not seek content of journalists’ calls or emails but rather information about who called or emailed whom and when. The Justice Department did not tell CNN which story was at issue, but during that period in 2017, Starr reported on options the U.S. military had prepared to present to President Donald Trump on North Korea, among other topics.

On Wednesday, CNN revealed that Zucker had been notified long before of “limited details” about the legal battle but was bound to secrecy by a court. That battle ended in late January, when CNN agreed to turn over some of the requested records, the news outlet reported.

CNN reported that its general counsel, David Vigilante, was first informed of the Justice Department’s pursuit of Starr’s records on July 17, 2020, when he was sent a secret order issued by a federal magistrate judge directing the network to turn over records of Starr’s emails kept on company servers. The decision, CNN reported, “would have meant providing more than 30,000 email records.”

CNN reported that Vigilante was initially ordered not to reveal the existence of the Justice Department’s demand to the network or to Starr. The news outlet reported that he sought help from lawyers Jamie Gorelick, Aaron Zebley and Paul Wolfson from the law firm WilmerHale and that they were able to debrief Zucker “with limited details early on as well.”

CNN’s revelation marks the second time in a week a news outlet has disclosed its lawyers and executives were under court restrictions preventing them from revealing legal negotiations over a Justice Department demand for reporters’ records.

On Friday, the New York Times reported that one of its top lawyers and other executives were subjected to similar restrictions during the Trump administration as the department pursued email records of four of its journalists. The department, which separately obtained the journalists’ phone records, ultimately dropped the request for email data.

A spokeswoman has said The Post’s lawyers were not subject to any gag orders as the Justice Department pursued phone and email records of its current and former journalists. The lawyers, she has said, learned of the records requests only when the reporters were notified. The reporters were told the department had obtained their phone data but not email records.

In a first-person account of the events, CNN’s Vigilante wrote on the network’s website that his attempts to negotiate with the Justice Department over the request “went nowhere.”

“Its lawyers showed no interest in exploring good faith ways to narrow the order,” Vigilante wrote. “Instead, we were met with a refusal to concede on any aspect of its wide scope, even after we confirmed there were over 30,000 responsive messages, 26,000 of which were wholly internal to the company and clearly irrelevant to the government’s investigation.”

Even before the Justice Department announced its new directive broadly barring seizures of reporters’ records, officials were required in most instances to get the attorney general’s sign-off before doing so and to notify the affected news organizations and allow them to negotiate. In the case of CNN and The Post, according to a person familiar with the matter, then-Attorney General William P. Barr approved seeking reporter records. This person spoke on the condition of anonymity because of the subject’s sensitivity.

It was not immediately clear who approved the request for Times reporters’ records, though a court order demanding email data came when Jeff Rosen was serving as acting attorney general under Trump.

CNN reported that it went to court in September 2020 seeking to quash or narrow the order for Starr’s records, and during a secret hearing in federal court in the Eastern District of Virginia on Oct. 7, Magistrate Judge Theresa Buchanan told the Justice Department to narrow its request.

Prosecutors returned to court two days later, CNN reported, sharing an affidavit that the news network was not allowed to see and persuading the judge to allow the request to proceed. CNN appealed in November.

In a Dec. 16 hearing, an attorney for CNN said the order was extremely broad, forcing Starr “to disclose every contact she had by e-mail over a two-month period, whether internal or external,” according to a transcript made public Wednesday.

Assistant U.S. Attorney Gordon Kromberg countered that if the network was privy to the classified information involved, it would be clear “that we tread very carefully and we did our best.” The Justice Department requested the order, he said, after “three-and-a-half years” of attempting to find the leaker through other avenues. He also said the “danger” and “harm” that prompted the investigation was ongoing.

Judge Anthony J. Trenga ruled that CNN must turn over Starr’s email contact records with military and government accounts. But he sided with the network on the disclosure of Starr’s other email records, saying that “the requested information by its nature is too attenuated and not sufficiently connected to any evidence relevant, material, or useful to the governments ascribed investigation, particularly when considered in light of the First Amendment activities that it relates to.”

CNN’s attorneys did not argue that any demand for records was invalid, only one this sweeping.

“Since we were never privy to any of the secret submissions made by the government, this was the first characterization of the evidence we had seen, and it was stunning: After months of secret proceedings and heavy-handed enforcement tactics, a neutral judge said that, in large part, the emperor had no clothes,” Vigilante wrote.

Vigilante wrote that the Justice Department filed court papers asking for reconsideration on Jan. 15 and that on Jan. 26 they reached a deal: CNN agreed to turn over records that were less voluminous than what the Justice Department had asked, and Starr could be involved in proceedings over further requests. He wrote that it was not until May 13 — when Starr received a letter from the government alerting her to the records requests — that he was finally allowed to talk to Starr and “at least acknowledge that such an order existed.”

Vigilante and Starr did not immediately respond to messages seeking comment Wednesday. An automated reply from Starr indicated she was away from the office and returning later and that replies might be delayed.