IN SALEM SUPERIOR COURT on Wednesday, Judge Thomas Drechsler had a few reasons to hold Willy Antonio Hernandez Camilo without bail.

Camilo had been charged with attempted murder for stabbing someone in a club in Lawrence. He had used a stolen identity and had failed to show up for an earlier hearing in 2017. But one big reason Drechsler decided to keep Camilo in custody, which he mentioned from the bench, was the judge’s fear that if Camilo was released, he would be deported and the state would miss the chance at justice for a stabbing that left the victim with a severed artery.

Julie Manganis, a staff writer at the Salem News, reported that two Immigration and Customs Enforcement agents sat in the back of the courtroom and then left after the judge revoked bail.

The federal Bureau of Prisons, which had Camilo in custody, initially rejected the Essex County District Attorney’s office request to hand him over to Bay State authorities, but after a “lengthy process,” the feds agreed.

The push and pull between state and federal law enforcement in Essex County could be taken from the pages of the lawsuit filed against ICE on Monday by Middlesex County District Attorney Marian Ryan and Suffolk County District Attorney Rachael Rollins. Ryan and Rollins are trying to keep the feds from taking people into custody when they show up at local courts.

The two DAs, both Democrats, joined public defenders and the Chelsea Collaborative in a federal suit seeking to bar ICE agents from going after their quarries at state courthouses.

Witnesses to crimes are less likely to testify when they fear that by showing up at court they risk being arrested by ICE, Rollins said.

The state prosecutors’ lawsuit followed closely on the heels of US Attorney Andrew Lelling’s controversial indictment last week of Newton District Court Judge Shelley Joseph and a former court officer for allegedly helping a defendant avoid an ICE agent waiting outside the courtroom to arrest him.

State court judges all across Massachusetts are significantly limited in their ability to respond to ICE’s non-judicial requests to detain immigrants in the country illegally. The Supreme Judicial Court’s Lunn decision outlawed detaining people solely at the request of ICE.

President Donald Trump barged into the legal thicket by leveling untrue accusations against the two prosecutors whose offices bring scores of cases against suspected criminals.

“These are people that probably don’t mind crime,” Trump said during a call to Boston Herald Radio on Wednesday, where he noted his 2020 campaign for re-election is underway. As usual, the president conflated the peaceful, otherwise-law-abiding immigrants who are in the country illegally, and thus subject to deportation, with the violent criminals who make up a minority of the population.

In Salem it is the state prosecutors who are bringing Camilo to trial for armed assault with intent to murder and trying to avoid a repeat of a 2018 incident where Victor Ramirez was deported to Guatemala before he could face justice in a Lawrence child rape case.