Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The chief justice of California's Supreme Court accused federal immigration authorities of "stalking" local courthouses on Thursday, joined a growing chorus of officials objecting to immigration detentions at courthouses.

In a letter to Attorney General Jeff Sessions and Homeland Security Secretary John Kelly, state Chief Justice Tani Cantil-Sakauye asked the federal government to immediately stop detaining suspected undocumented immigrants at courthouses in California.

California Chief Justice Tani Cantil-Sakauye in 2010. Robert Galbraith / Reuters

"Enforcement policies that include stalking courthouses and arresting undocumented immigrants, the vast majority of whom pose no risk to public safety, are neither safe nor fair," she wrote. "They not only compromise our core value of fairness but they undermine the judiciary’s ability to provide equal access to justice."

In recent weeks, state and local authorities in other jurisdictions, including Multnomah County, Oregon, and El Paso, Texas, have gone public with their objections to what they have called "raids" by agents of Immigration and Customs Enforcement inside courthouses or on courthouse grounds.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Virginia Kice, a spokeswoman for ICE's Western regional office, told NBC News on Thursday that the agency had no comment on Cantil-Sakauye's letter. But she confirmed and defended the practice of detaining undocumented immigrants at courthouses in general.

"While ICE does arrest targets at courthouses, generally it's only after investigating officers have exhausted other options," she said, noting that many local law enforcement agencies refuse to honor ICE detainer requests.

Kice said that many of those detained at or near courthouses have previous convictions and that they would have been turned over to ICE upon their releases from jail, anyway.

"While ICE does arrest targets at courthouses, generally it's only after investigating officers have exhausted other options."

"When criminal custody transfers occur inside the secure confines of a jail or prison, it's far safer for everyone involved, including our officers and the person who's being arrested," she said.

A particularly high-profile detention occurred Feb. 9 at the El Paso County Courthouse, where security video recorded ICE agents arresting Irvin González, a transgender woman from Mexico, who was at the courthouse to seek a protective order against her alleged abuser.

Rep. Beto O'Rourke, D-Texas, told NBC affiliate KTSM at the time that victims of crime should be able to feel safe inside a courthouse.

In her letter Thursday, Cantil-Sakauye sounded a similar warning.

"I am concerned about the impact on public trust and confidence in our state court system if the public feels that our state institutions are being used to facilitate other goals and objectives, no matter how expedient they may be," she wrote.

The ICE policy mirrors promises President Donald Trump made during his campaign last year, but it doesn't appear to be in response to the president's urgings.

Local officials have complained about such operations for several years — as long ago as 2014, 20 members of the Wisconsin Legislature objected to the presence of ICE agents who were stopping and questioning Latinos inside county courthouses.