A federal appeals court on Thursday barred federal prosecutors in Maryland from continuing to directly review thousands of files obtained from a search warrant executed in June at a Baltimore law firm.

The case in the U.S. Court of Appeals for the Fourth Circuit, which heard arguments Tuesday, is unfolding largely under a seal that shields the names of the law firm, and lawyers, who were subject to the search warrant. The Baltimore Sun identified the targets of the obstruction investigation as two criminal defense lawyers.

The U.S. Attorney's Office for Maryland had been using an internal "filter" team—separate from the primary investigators—to review thousands of emails seized during the raid at the firm. Lawyers challenging the scope of the review had urged the appeals court to let a U.S. magistrate judge, not prosecutors, conduct the review.

The three-judge appeals panel—Chief Judge Roger Gregory, sitting with judges Robert King and Allison Rushing—overturned a ruling that had let the Justice Department's filter team look at the seized files. The appeals court said in an order that "the duties and functions previously assigned to the filter team are hereby reassigned to the magistrate judge."

It's rare for federal appeals courts to issue orders so shortly after an oral argument. The panel said it was issuing an order now "in the interests of justice and to expedite the proceedings." The court said it plans to post an opinion later.

A spokesperson for the U.S. attorney's office for Maryland said prosecutors would adhere to the court's order but declined to comment further.

Derek Hines, the assistant U.S. attorney in Maryland who argued in the appeals court, told the judges Tuesday that prosecutors had taken steps to minimize the intrusion on secrecy protections accorded to attorneys and their relationships with clients.

Among other things, Hines said, the government asked the law firm, whose name was not mentioned during the hearing, to provide a list of clients. That request, presumably done to stop prosecutors from seeing things unrelated to their investigation, still drew concern from King, a former federal prosecutor and private lawyer who has served on the Fourth Circuit since 1998.

"How can they give you a list of clients?" King asked. "Attorney-client relationship is none of the government's business," King declared. "Have you ever practiced law? Have you ever practiced law privately?"

"I have, your honor," Hines said.

"Have you had a client walk in and talk to you about a criminal matter?" King asked.

"Yes, I have, your honor," said Hines, a Pepper Hamilton associate in Philadelphia from 2012 to 2015.

"And that's protected by the attorney-client privilege," King said. "And you have an attorney-client relationship. Is the existence of that relationship, prior to the charge or something in the public record, is that any of the government's business? Answer that—yes or no."

"It is not protected by privilege," Hines said.

King responded: "It is. The existence of it is. It's not a matter of public record. It's none of the government's business."

Hines, a federal prosecutor in Maryland since 2016, argued the content of communication between an attorney and a client carries some protections from disclosure but not the mere fact a relationship exists.

"We absolutely respect the attorney-client privilege," Hines said during one exchange with King. Hines said there is no record of harm in the investigation, and that the government, supervised by a judge, had committed no wrongdoing.

The appeals court heard arguments for about an hour. King said at one point that, as a former private lawyer and prosecutor, he would have recoiled at the idea of government attorneys searching his files.

"I would of hated to think the government hauling my filing cabinet down to the IRS office and holding onto it for two months and rummaging through it," King said.

The Justice Department hasn't charged any target in the ongoing investigation, and the review of the seized law firm files "has been substantially completed," Hines said in court. The target lawyer, according to prosecutors, "routinely practices in federal courts" and "engaged in criminal conduct while he was representing another attorney."

Prosecutors said they did not seek a search warrant "lightly."

"Rather, this warrant request came after the government exhausted its investigative efforts through other means," Hines wrote in a brief. "And even then, the assistant United States attorneys investigating this matter (the 'investigative team') first obtained the approval of the United States Attorney for the District of Maryland."

James Ulwick of Baltimore's Kramon & Graham argued for the challengers at Tuesday's hearing in the Fourth Circuit.

"Our criminal justice system depends on a robust adversarial process, protected through the Sixth Amendment right to counsel," Ulwick said in a brief. "That process breaks down when the public perceives that confidential materials are at risk of disclosure to prosecutors."