BOSTON -- A Newton District Court judge and former court officer were indicted Thursday on federal obstruction of justice charges for their alleged involvement in helping an undocumented immigrant evade immigration authorities.

U.S. Attorney Andrew Lelling announced the charges Thursday, alleging that Judge Shelley Richmond Joseph, 51, and former court officer Wesley MacGregor, 56, worked to allow a defendant to leave through a back door of the courthouse, avoiding a federal Immigration and Customs Enforcement officer who intended to detain him.

"This case is about the rule of law," Lelling said in a statement. "The allegations in today's indictment involve obstruction by a sitting judge, that is intentional interference with the enforcement of federal law, and that is a crime. We cannot pick and choose the federal laws we follow, or use our personal views to justify violating the law."

The Supreme Judicial Court announced after the indictment was unsealed that Joseph had been suspended without pay until further order because of the alleged misconduct, but it noted that decision "in no way reflects any opinions on the merits" of the case.

The indictment alleged that on April 2, 2018, a man facing drug charges was brought before Joseph for a hearing. An ICE officer had earlier that day announced to the court his presence and intent to arrest the defendant, who had been deported twice before, on an immigration detainer, according to the indictment.

Authorities allege that Joseph ordered the court clerk to ask the ICE officer to wait by the building's front door for the defendant. During the afternoon session, Joseph allegedly turned off the courtroom's audio recorder -- in violation of District Court rules -- and then allowed MacGregor to escort the defendant, his attorney and an interpreter downstairs, where MacGregor opened a rear exit to release the defendant.

Joseph and MacGregor each face one count of conspiracy to obstruct justice and two counts of obstruction of justice - aiding and abetting. MacGregor is also charged with one count of perjury for allegedly telling a federal grand jury he did not know an ICE agent was present in the courthouse on that day.

"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 Lyons, acting director of ICE's Boston field office. "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."

Joseph and MacGregor were scheduled to appear Thursday in federal court, according to Lelling's office.

Gov. Charlie Baker, who appointed Joseph in 2017, said in December after federal authorities opened an investigation into the matter that he wanted Joseph suspended until the case was resolved.

In a Thursday statement, Lizzy Guyton, Baker's communications director, said the governor "believes no one should obstruct federal law enforcement officials trying to do their jobs and supports the Supreme Judicial Court's decision to suspend Judge Joseph without pay." She also pointed to legislation filed by the administration allowing courts and law enforcement to work with federal immigration enforcement to detain individuals deemed dangerous.

The indictment sparked immediate backlash from some state officials and advocacy groups.

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

Carol Rose, executive director of the American Civil Liberties Union of Massachusetts, said in a statement that the charges are "deeply damaging to the rule of law."

"In contrast to Attorney General William Barr's famously narrow view of what constitutes obstruction of justice -- at least when it comes to President Trump -- the Department of Justice has now charged a state judge and court security officer based on a theory of obstruction that is shockingly aggressive," Rose said. "In this case, like so many others across Massachusetts, an ICE officer staked out a state court and made it difficult for court officials to do their job, which is to ensure that people in state court have access to justice. But instead of rethinking its own awful behavior, the federal government has now charged a judge and a court officer with crimes."