District Court Judge Shelley M. Richmond Joseph departs federal court, Thursday, April 25, 2019, in Boston after facing obstruction of justice charges for allegedly helping a man in the country illegally evade immigration officials as he left her Newton, Mass., courthouse after a hearing in 2018. (AP Photo/Steven Senne)

BOSTON (AP) — A Massachusetts judge was indicted Thursday on charges that she helped a man who was living in the U.S. illegally sneak out a back door of the courthouse to evade a waiting immigration enforcement agent.

Newton District Court Judge Shelley M. Richmond Joseph and former court officer Wesley MacGregor were charged with obstruction of justice based on accusations that they schemed to let the man escape after a hearing last year on charges that included drug possession.

The charges against Joseph and MacGregor were swiftly condemned in a statement from the state’s attorney general, who called the case “a radical and politically-motivated attack” on the courts by federal authorities.

Lawyers, judges and advocates have criticized President Donald Trump’s administration for stepping up immigration arrests at courthouses, saying it is disrupting the criminal justice system and scaring people away from halls of justice.

Massachusetts U.S. Attorney Andrew Lelling said the charges were not meant to send a message about immigration policy. He said everyone must be held to the rule of law, even the privileged and powerful.

“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.”

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.

Authorities say an immigration agent was in the courtroom to detain the man when he appeared in the Newton courthouse in April 2018. The Dominican man had twice been deported and had been barred from entering the U.S. until 2027, prosecutors say.

Authorities say Joseph’s clerk asked the agent to leave the courtroom and told him that the suspect would be released into the courthouse lobby.

Instead, after the hearing, MacGregor led the defendant downstairs to the lockup and let him out a rear door, prosecutors say.

The man was caught by immigration officials about a month later, Lelling said, and is now in immigration proceedings.

The Trump administration has resisted calls to add courthouses to the list of so-called “sensitive locations” that are generally free from immigration enforcement, like schools and places of worship.

Immigration officials have said communities are forcing their hand by refusing to transfer immigrants in local prisons and jails to the custody of Immigrations and Customs Enforcement. They also argue that courthouse arrests are safer for agents because people have to go through metal detectors when they enter courthouses.

Courthouse arrests happened under former Democratic President Barack Obama, but advocates and lawyers across the country have said the practice has increased under Trump.

MacGregor, the former court officer, was also charged with perjury. Authorities say he falsely told the grand jury that he was unaware that immigration agents were in the courthouse before he let the suspect out the door.

“Abuses of power hurt us all,” said Peter Fitzhugh, special agent in charge of U.S. Immigration and Customs Enforcement Homeland Security Investigations in Boston. “It undermines the core mission of government to serve the people. It has no place in a just and accountable society.”

Massachusetts Attorney General Maura Healey blasted Lelling for the charges, saying the matter could have been handled by the state’s Commission on Judicial Conduct and the trial court.

“Today’s indictment is a radical and politically-motivated attack on our state and the independence of our courts,” Healey said in an emailed statement. “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.”

Carol Rose, executive director of the ACLU of Massachusetts, called the case “preposterous, ironic, and deeply damaging to the rule of law.”