The Massachusetts judge accused of helping an illegal immigrant evade an Immigration and Customs Enforcement officer has pleaded not guilty to all counts.

Newton District Court Judge Shelley M. Richmond Joseph, 51, appeared in U.S. District Court in Boston on Thursday, where she was arraigned on obstruction of justice stemming from an incident that allegedly took place on April 2, 2018.

RELATED: MASSACHUSETTS JUDGE WHO HELPED ILLEGAL IMMIGRANT ESCAPE ICE ARREST INDICTED, FEDERAL AUTHORITIES SAY

Prosecutors claimed in court documents earlier Thursday that Joseph, along with 56-year-old court officer Wesley MacGregor, helped Jose Medina-Perez, a twice-deported illegal immigrant with a fugitive warrant for drunk driving in Pennsylvania, sneak out a back door after he appeared in court to be arraigned on drug charges, according to MassLive.com.

Authorities alleged that Joseph asked an immigration agent who was in the courtroom to leave, and said Medina-Perez would be released into the courthouse lobby. But after the hearing, MacGregor led him downstairs to the lockup and out a back door, U.S. Attorney for the District of Massachusetts Andrew Lelling said.

Medina-Perez, who had been barred from entering the U.S. until 2027, was caught by immigration officials about a month after the hearing, Lelling said, and is now in immigration proceedings.

Both Joseph and MacGregor were charged with obstruction of justice, aiding and abetting; obstruction of a federal proceeding, aiding and abetting and conspiracy to obstruct justice. MacGregor was also charged with perjury before a federal grand jury.

Andrew Lelling, U.S. Attorney for the District of Massachusetts, announced charges on Thursday against Newton, Mass., District Court Judge Shelley M. Richmond Joseph and a former court officer for obstruction of justice. (AP)

MacGregor also pleaded not guilty to all counts in court on Thursday.

Massachusetts Attorney General Maura Healey said in a statement that the indictment "is 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," she continued. "This matter could have been appropriately handled by the Commission on Judicial Conduct and the Trial Court. I am deeply disappointed by U.S. Attorney Andrew Lelling’s misuse of prosecutorial resources and the chilling effect his actions will have.”

CLICK HERE TO GET THE FOX NEWS APP

Lelling said the charges were not meant to send a message about immigration policy. He said he's "heard the occasional gasp of dismay or outrage at the notion of holding a judge accountable for violating federal law ... but if the law is not applied equally it cannot credibly be applied to anyone."

Both Joseph, who has been suspended without pay, and MacGregor were released after the hearing on Thursday. No date has been set for their next court appearance.

Fox News' Katherine Lam and The Associated Press contributed to this report.