A Massachusetts judge accused of helping an undocumented immigrant evade federal agents waiting to arrest him will be paid while she fights criminal charges against her, a judicial panel ruled Tuesday.

In a 5-1 decision, the state Supreme Judicial Court ruled that Newton District Court Judge Shelley Joseph can resume collecting her annual $181,000 salary. The panel also ruled that Joseph will receive back pay retroactive to April, a reversal of an earlier ruling that said she should be suspended without pay.

"In turbulent times, the risk of being stripped of a paycheck may have a chilling effect on a judge’s willingness to challenge the conduct of a prosecutor and thereby diminish the overall independence of the judiciary,” Chief Justice Ralph Gants wrote.

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

District Court Judge Shelley M. Richmond Joseph, seen here in April. (AP Photo/Steven Senne, File)

In a dissenting opinion, Justice Frank Gaziano said the decision “smacks of preferential treatment and thereby erodes public confidence in the judiciary.”

Along with a court officer, Joseph is charged with obstruction of justice, aiding and abetting; obstruction of a federal proceeding, and conspiracy to obstruct justice.

She has pleaded not guilty.

TAXPAYERS PAID $127G IN LEGAL BILLS FOR JUDGE ACCUSED OF HELPING ILLEGAL IMMIGRANT AVOID ICE: REPORT

Prosecutors allege Joseph and Court Officer Wesley MacGregor, 56, helped Jose Medina-Perez, a twice-deported immigrant from the Dominican Republic, slip out of a courthouse through a back door in April 2018 and elude Immigration and Customs Enforcement agents.

Media-Perez was wanted on a fugitive warrant for drunken driving in Pennsylvania. He had appeared in the Massachusetts court in April 2018 to be arraigned on drug charges.

He was caught a month after the hearing and is barred from entering the United States until 2027.

CLICK HERE TO GET THE FOX NEWS APP

Lawyers and judges have rallied behind Joseph, calling it "unprecedented" to take away her pay while she has yet to be convicted.

She faces up to 20 years in prison.

The Associated Press contributed to this report.