Newton District Court Judge Shelley M. Richmond Joseph has been indicted on obstruction of justice charges for allegedly helping a man in the country illegally evade Immigration and Customs Enforcement (ICE) officials.

Massachusetts U.S. Attorney Andrew Lelling announced Thursday that Joseph and former court Officer Wesley MacGregor were charged with one count of conspiracy to obstruct justice and two counts of obstruction of justice — aiding and abetting. MacGregor was also charged with perjury.

"We cannot pick and choose the federal laws we follow, or use our personal views to justify violating the law," Lelling said in a statement. "Everyone in the justice system — not just judges, but law enforcement officers, prosecutors, and defense counsel — should be held to a higher standard.”

Massachusetts Attorney General Maura Healey in a statement called the indictment of Joseph "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," Healey said. "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.”

Joseph, 51, and MacGregor, 56, pleaded not guilty during brief appearances in Boston federal court. Joseph appeared to fight back tears as she left the courthouse.

"This prosecution is absolutely political. Shelley Joseph is absolutely innocent," her attorney, Thomas Hoopes, told reporters.

An email seeking comment was sent to a public defender for MacGregor.

Joseph, who was appointed as a District Court judge in 2017, has been suspended without pay, the Massachusetts Supreme Judicial Court said.

Joseph came under federal investigation after authorities said she and her staff helped a defendant, Jose Medina-Perez, who is from the Dominican Republic, leave the courthouse in April 2018 after a hearing on charges, including drug possession.

Prosecutors say an ICE agent was at the courthouse to detain the man following the hearing, but Joseph and the court officer schemed to help him leave out a back door. Authorities allege that Joseph asked the agent to leave the courtroom and told him that the suspect, who had been deported twice and was barred from entering the U.S. until 2027, would be released into the courthouse lobby.

Instead, after the hearing, MacGregor led the defendant downstairs to the lockup and let him out the rear door, Lelling said.

The suspect was caught by immigration officials about a month after the hearing, Lelling said, and is now in immigration proceedings.

“The actions of the judge in this incident are a detriment to the rule of law and highly offensive to the law enforcement officers of ICE who swear an oath to uphold our nation’s immigration laws,” said Todd M. Lyons, the acting field office director of ICE’s Enforcement and Removal Operations in Boston, in a statement. “In order for our criminal justice system to work fairly for all people, it must be protected against judicial officials who would seek to replace the implementation of our laws with their own ideological views or politically-driven agenda.”

Lelling said the charges were not meant to send a message about immigration policy.

"From certain corners I have heard the occasional gasp of dismay or outrage at the notion of holding a judge accountable for violating federal law," Lelling said. "But if the law is not applied equally it cannot credibly be applied to anyone."

Associated Press reporter Alanna Durkin Richer contributed to this report.