A federal judge ruled on Monday that there is evidence of misconduct in how a prosecutor closely aligned with former President Donald Trump secured criminal charges against former FBI Director James Comey, ordering that grand jury materials be turned over to Comey’s defense team.

U.S. Magistrate Judge William Fitzpatrick found that Lindsey Halligan, the Trump-appointed U.S. attorney leading the case, may have committed significant legal errors when presenting evidence and instructing grand jurors. Fitzpatrick warned that these missteps could have compromised the integrity of the grand jury proceedings.

“The record points to a disturbing pattern of profound investigative missteps, missteps that led an FBI agent and a prosecutor to potentially undermine the integrity of the grand jury proceeding,” Fitzpatrick wrote.

Comey, a frequent critic of Trump, is one of three high-profile Trump opponents to face criminal charges from the former president’s Justice Department in recent months.

Critics of Trump have characterized the cases as politically motivated attempts to intimidate dissent. Comey pleaded not guilty in September to charges of making false statements and obstructing a congressional investigation.

Concerns about Halligan’s qualifications and appointment have surfaced before. Another judge previously questioned the legality of her selection, and other courts have raised alarms about political influences on Justice Department investigations.

Halligan, appointed in September, had no prior prosecutorial experience and previously worked primarily in real estate law, including representing Trump in civil litigation.

The Justice Department declined to comment on the ruling. Prosecutors moved quickly to halt Fitzpatrick’s order to release grand jury materials, arguing in a court filing that the judge “may have misinterpreted some facts.”

Comey has sought to dismiss the charges, arguing that the prosecution grew out of Trump’s “personal spite” over Comey’s public criticism and his role in investigating contacts between Trump’s 2016 campaign and Russia.

His indictment was soon followed by charges against two other prominent Trump critics: former national security adviser John Bolton and New York Attorney General Letitia James.

The trio of cases marks a break from the Justice Department’s long-standing norms of political independence in criminal matters.

Prosecutors accuse Comey of lying to a Senate committee in 2020 when he said he stood by earlier testimony that he had not authorized FBI personnel to act as anonymous sources regarding investigations into Trump and 2016 Democratic nominee Hillary Clinton.