A Massachusetts judge and a court officer were charged with obstruction of justice for allegedly helping an undocumented immigrant wanted by ICE to slip out of court undetected, federal prosecutors announced on Thursday.

Middlesex County Judge Shelley Richmond Joseph and court officer Wesley MacGregor are accused of helping an undocumented immigrant last April escape Newton District Court while an ICE agent waited outside of Joseph’s courtroom to arrest him on a federal detainer.

“I’m not gonna allow them to come in here,”Joseph allegedly told the man’s defense attorney. Then MacGregor allegedly turned off the court’s recording device and used his security card to unlock a rear exit so the immigrant could leave. It was not clear what happened to the immigrant after he escaped.

Joseph and MacGregor were charged with three counts: conspiracy, aiding and abetting, and obstruction of a federal proceeding. MacGregor was additionally charged with perjury for allegedly lying to a grand jury when he said he wasn't aware an ICE officer was in the courthouse that day.

“This case is not about immigration. It is about the rule of law. We don’t get to pick and choose the federal laws that we follow,” U.S. Attorney Andrew Lelling said in a Thursday press conference announcing the charges.

The immigrant was not identified in the Thursday indictment, but has been previously identified as 38-year-old Jose Medina-Perez, a Dominican Republic national. On March 30, Medina-Perez was arrested by Newton Police and charged with narcotics possession and fleeing a drunk-driving warrant in Pennsylvania.

The indictment alleges he “had been previously deported from the United States by federal immigration officials in 2003 and again in 2007.” When his fingerprints were taken, ICE became aware of the arrest and issued an order for his detainment.

Joseph, a former prosecutor and defense attorney, was appointed by Gov. Charlie Baker in October 2017. The Massachusetts Supreme Judicial Court ordered Joseph to be suspended without pay on Thursday, just hours after the federal indictment was announced.

Massachusetts Attorney General Maura Healey, a Democrat, blasted Thursday's indictment, calling it “a radical and politically-motivated attack on our state and the independence of our courts.”

“It is a bedrock principle of our constitutional system that federal prosecutors should not recklessly interfere with the operation of state courts and their administration of justice I am deeply disappointed by U.S. Attorney Andrew Lelling’s misuse of prosecutorial resources and the chilling effect his actions will have,” she said in a statment.

The pair are expected to appear in court later Thursday.