The chief justice of New Jersey's Supreme Court on Wednesday asked the Trump administration to refrain from arresting immigrants inside courthouses, warning that current practice could erode public confidence in the justice system.

Chief Justice Stuart Rabner said federal immigration authorities had recently arrested two people who showed up for court appearances in state court. The arrests were made in Passaic and Middlesex Counties, according to a spokesman for the New Jersey courts.

"When individuals fear that they will be arrested for a civil immigration violation if they set foot in a courthouse, serious consequences are likely to follow," Rabner wrote in a letter to John F. Kelly, secretary of homeland security.

Rabner said this fear could deter a number of people from appearing in court, including witnesses to violent crimes, victims of domestic violence, and children and families in need of assistance.

A spokesman for U.S. Immigration and Customs Enforcement said the agency determined where and how to carry out arrests "on a case-by-case basis, taking into account all aspects of the situation, including the prospective target's criminal history, safety considerations, the viability of the leads on the individual's whereabouts, and any sensitivities involving the prospective arrest location."

"While ICE does arrest targets at courthouses, generally it's only after investigating officers have exhausted other options," said the spokesman, Lou Martinez, who added that many of these targets "are foreign nationals who have prior criminal convictions in the U.S."

President Trump had made cracking down on illegal immigration the centerpiece of his campaign.

Rabner's request follows a similar one made last month by the chief justice of California's Supreme Court, Tani G. Cantil-Sakauye. She protested that federal agents were "stalking undocumented immigrants" to make arrests.

In response to the California judge's letter, Kelly and Attorney General Jeff Sessions wrote that the "arrest of persons in a public place based upon probable cause has long been held by the United States Supreme Court as constitutionally permissible."

ICE officers and agents, they wrote in a March 29 letter, "are authorized by federal statute to make arrests of aliens where probable cause exists to believe that such aliens are in violation of immigration laws."

Rabner, the New Jersey judge, was nominated to the high court by Gov. Jon Corzine, a Democrat, in 2007 and renominated for tenure by Gov. Christie, a Republican, in 2014. Rabner had been a top prosecutor under Christie when he was U.S. attorney for the district of New Jersey.

Christie, who campaigned against so-called sanctuary cities during his bid for president last year, said in a statement: "I do not believe now, nor have I ever believed that it is appropriate for the chief justice of the State of New Jersey to be attempting to dictate law enforcement policy to federal agencies."

The governor has clashed with Rabner in the past and at one point appeared poised to deny the judge tenure to the Supreme Court.

As chief justice, Rabner is also the top administrator for New Jersey's court system.

In his letter, Rabner said state courts and corrections officials had cooperated with federal immigration authorities' detainer requests for "the surrender of defendants who are held in custody."

"That practice is different from carrying out a public arrest in a courthouse for a civil immigration violation, which sends a chilling message," he wrote.

Schools, houses of worship, and hospitals are treated as "sensitive locations" where federal immigration agents don't make arrests, Rabner said. The same standard should be applied to courthouses, he said.

Martinez, the ICE spokesman, declined to comment on Rabner's letter but said that "because courthouse visitors are typically screened upon entry to search for weapons and other contraband, the safety risks for the arresting officers and for the arrestee are substantially diminished."