BOSTON — Two of the top judges in Massachusetts took issue Wednesday with recent criticism of the state's judicial system and individual judges, arguing that attacks on jurists can put judicial independence and fair access to justice at risk.

Massachusetts Supreme Judicial Court Chief Justice Ralph Gants and Trial Court Chief Justice Paula Carey, speaking to fellow judges, lawyers, policymakers and others at the annual State of the Judiciary event, both denounced what Carey called "the public criticism and personal attacks recently directed with increasing intensity at the judicial system and individual judges."

Gants called the situation "some semblance of a threat to the independence of the judiciary and the rule of law."

Neither judge cited any specific examples, but Gants alluded to a recent attempt by some Republican lawmakers to remove a judge from his positions for decisions they disagreed with.

"Judges sometimes make mistakes; if they did not, we would not need appellate courts. And even when judges act properly within the bounds of the law, it is inevitable that in difficult cases some people will disagree with our decisions. It is fair game to criticize a judge's decision," Gants said.

He added, "But threatening judges with removal solely because of a mistake or an unpopular decision threatens the independence of the judiciary and, more importantly, threatens our constitutional obligation to apply the law equally and fairly to every litigant, whether that litigant be a sex offender, a drug dealer, a drug addict, or the Commonwealth, a landlord or a tenant, a husband or a wife, an alleged abuser or a victim of abuse."

In the last year, a few Republican members of the Massachusetts House have sought to advance a bill of address seeking the removal of Judge Timothy Feeley, who came under fire over controversial rulings, including sentencing Manuel Soto-Vittini to probation instead of prison time after he pleaded guilty to drug-dealing charges.

The Salem News reported that Feeley said he would have sent Soto-Vittini, who was arrested in 2015 and found with more than half an ounce of heroin in a secret compartment in his car, to a house of correction if he had been an American citizen.

Regarding another case, Gov. Charlie Baker faced heat in August from WEEI co-host Kirk Minihane during a telethon over a Quincy District Court judge who, according to MassLive, set bail for accused Weymouth cop-killer Emanuel Lopes at $500 for a drug charge last year before he allegedly commited murder.

"Judges should, of course, be held accountable for misconduct. If we violate the Code of Judicial Conduct, we should be subject to discipline and, in the most egregious case, removal," Gants said Wednesday. "But it is crucial to distinguish between judicial misconduct that merits discipline and mere disagreement with a judge's exercise of discretion within the bounds of what the law allows."

The chief justice, again without citing a specific example, said the court "recently demonstrated that it will not hesitate to take serious action when a judge's improper behavior brings the judiciary into disrepute." In June, Judge Thomas Estes of the Northampton District Court resigned after the SJC rebuked him for "egregious, deliberate, and repeated acts of misconduct" related to a sexual relationship, conducted at least in part at the courthouse, with a woman who worked under him.

Judges, Gants said, must be free to make decisions based on the law and the facts in front of them and must be "unburdened by any fear that a controversial decision may jeopardize their careers." In Massachusetts, judges are nominated by the governor and confirmed by the Governor's Council. Judges can serve until they reach the mandatory retirement age of 70.

Carey, who oversees the superior, district, housing, juvenile, land, and probate and family courts, as well as Boston Municipal Court and the state's probation and jury commissioner offices, said her office is re-evaluating its internal policies around what it can and cannot say when a judge's decision is criticized publicly "due to concerns raised about the speed of our media response and the expanded use of social media."

"Our need to respond to these situations must be properly balanced with respect and sensitivity for the family and community grief associated with tragic events," Carey said.

During his speech Wednesday, Gants congratulated the state Legislature for its passage in April of criminal justice reform legislation, which he called "an impressive achievement of substance, thoughtful compromise, and legislative craftsmanship."

But he also spoke of the need for the Legislature to focus its next criminal justice reform efforts around "reentry and include the funding needed to give defendants a fair and reasonable chance of succeeding upon release."

Gants said the court system has been trying to empower probation officers to do more in a role of "service or reentry coordinator" who can help connect the probationer with the services that will help keep them from re-offending or that will help them better adjust to society after being released.

"When we equip probation officers to focus their efforts on high-risk, high-need probationers, when we employ evidence-based practices to match each intervention to each probationer, and when we make available to probationers the specialized services they need to succeed, we will reap the recidivism reduction fruits of criminal justice reform," Gants said.