The matter is the latest example of competing federal and local interests as concerns about immigration crackdowns under President Donald Trump continue to mount.
The chief justice of California's Supreme Court, Tani Gorre Cantil-Sakauye
, requested that federal agents stop conducting actions in the state's courthouses.
"Courthouses should not be used as bait in the necessary enforcement of our country's immigration laws," she wrote Thursday to Attorney General Jeff Sessions and Homeland Security Secretary John Kelly.
"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 added.
US Immigration and Customs Enforcement, in a statement, said courthouse arrests are made "only after investigating officers have exhausted other options" and "every effort is made to take the person into custody in a secure area, out of public view, but this is not always possible."
The agency declined to comment on the letter to Kelly.
ICE does not consider courthouses sensitive locations
, the agency states on its website. Places where agents generally avoid making arrests include schools, hospitals, churches and ceremonies, the ICE guidelines state.
The practice of arresting undocumented immigrants at courthouses isn't new. It has been reported in previous years and has triggered outcry from immigration advocates and lawyers.
Lawyer: 'It's very shocking'
Arrests at courthouses since Trump took office have raised concerns from immigration lawyers, who say such practices will have a chilling effect and deter victims from reporting crimes.
Defense lawyer Octavio Chaidez said he and his client had finished a criminal court appearance at the Los Angeles Superior Court in Pasadena when four ICE agents approached them. The agents confirmed his client's name and took him away while they were inside the courthouse.
"It was very shocking because it occurred inside of a courthouse, and the reason for the detention had nothing to do with that proceeding," Chaidez told CNN affiliate KCAL/KCBS.
He would not say if his client has a criminal history.
Having ICE agents arrest people at courthouses could undermine the justice system, Chaidez said.
"They may refuse to contact the police. They may refuse to give testimony as a witness. They may refuse to show up in court, and that affects the entire system," he told the Los Angeles TV station.
Other arrests made in courthouses
Beyond California, the presence of federal immigration agents at several courthouses has been reported.
In January, officials in Multnomah County, Oregon, reported increased ICE activity around and inside the courthouse.
"Courthouses need to be safe locations for people to access justice: whether to contest an eviction, seek a restraining order from abuse, or attend a custody hearing. Now, they may be too afraid to show up," county commissioners, the sheriff, a judge and the district attorney wrote in a joint statement.
"This is devastating for the people accessing our services, and in many cases, counterproductive to a lawful community."
In February, a transgender woman was arrested by immigration agents at the courthouse in El Paso County, Texas, as she was filing a protective order against her partner, reported CNN affiliate KVIA.
The woman's detainment sparked outcry among advocates and local officials, who said the move would discourage victims of domestic violence from coming forward. The news station reported that the woman had an extensive criminal history and had been deported several times.
More pushback from local authorities
The arrests of undocumented immigrants at courthouses is just one flashpoint between local and federal authorities, and points to the larger battlefront over so-called sanctuary cities.
The term broadly describes local governments that have enacted policies limiting their cooperation with federal immigration enforcement. The goal: to protect undocumented immigrants who are not otherwise engaged in criminal activity from being detained or deported.
Hundreds of cities, counties and states across the country are considered sanctuaries.
Those who support sanctuary policies say they build trust with local law enforcement and keep communities safer. ICE has said such policies inhibit its ability to enforce laws.
Trump signed an executive order in January pledging to block sanctuary jurisdictions from receiving federal grant money
. Leaders of sanctuary cities across the country have vowed not to back down.