The battles between so-called sanctuary cities and the Trump administration are increasingly moving to state courts, where lawyers for immigrants have started to convince judges that state laws prohibit local law enforcement from cooperating with federal immigration agents.

The lawyers said they were turning to more liberal state courts to challenge the Trump administration’s policies in part because they believed that they would be less likely to succeed in a federal judiciary that is growing more conservative — and might ultimately lose in a Supreme Court with two appointees of President Trump.

Lawyers have also been encouraged by a series of recent successes in state law cases, which they say represent a long overdue reconciling between a deportation system that relies on local law enforcement and the state laws that determine the authority of local law enforcement.

Last month, New York became the second state in which an appellate state court ruled that local law enforcement officers could not detain immigrants for Immigration and Customs Enforcement, which then typically puts them into the deportation system.