Since last year, immigration agents have been making arrests far more frequently in New York City’s courthouses, sparking outrage from lawyers, district attorneys and activists.

Their fight has been with the federal authorities. But now, a rift has erupted along local lines.

It started when agents for United States Immigration and Customs Enforcement, known as ICE, detained two undocumented immigrants who had come to Queens Criminal Court on minor charges. In protest, lawyers for the Legal Aid Society of New York and Queens Law Associates staged a walkout, saying ICE should stay out of courthouses. It was the second such walkout this week, and the fifth in the last year.

The Office of Court Administration, which oversees the courts in New York State, responded by fulfilling a warning it had made an hour earlier: if the public defenders walked out on the job while court was still in session, cases would be reassigned to private defense lawyers under contract to represent the poor. Ten cases were reassigned.

The public defense organizations saw it as punishment for political advocacy; court administrators saw it as a matter of keeping the courts running.