In an unexpected but welcome victory for immigration enforcement, a notoriously liberal federal appellate court has ruled that a southern California city can enforce a law that allows police to arrest illegal alien day laborers who solicit work on public streets.

The surprise ruling, issued this week by the San Francisco-based 9th Circuit Court of Appeals, comes amid legal defeats to a number of local ordinances enacted to help curb a nationwide crisis caused by illegal immigration. In this case, the Los AngelesCounty city of Redondo Beach initially suffered a legal defeat.

In 2006 a federal judge ruled that the city’s ban on day laborer solicitations violates the First Amendment free speech rights of illegal immigrants and targets a certain group. The measure was actually passed more than two decades ago but the city didn’t begin enforcing it until 2004 and an immigration advocacy group filed a lawsuit after police arrested numerous violators. Judicial Watch filed an amicus curiae brief with the federal appellate court in support of the city.

In its decision, a divided 9th Circuit panel consisting of three judges said that Redondo Beach’s ordinance is a reasonable response to traffic problems that officials say day laborers soliciting work are causing at two city intersections. Furthermore, the ruling says that Redondo Beach’s law is constitutional because the activities it aims to restrict are broad and it specifically addresses safety concerns.

In a dissenting opinion, Judge Kim Wardlaw maintains that the measure violates day laborers’ free speech rights because its “overbroad and thus violates well-established principles of our First Amendment jurisprudence.” Laws in other parts other country designed to ban day laborers have faced similar scrutiny from different courts.

Just last month a federal judge in New York ruled that a Long Island town can’t enforce its “unconstitutional” law prohibiting illegal immigrant day laborers from seeking work on public property and people from hiring them. Oyster Bay passed the public safety measure last fall because day laborers—and those who hire them—were creating dangerous traffic situations in the municipality’s main roads. In a lawsuit, a group of day laborers claimed that the town enacted a law with a “discriminatory community animus” against Latinos.

A similar ordinance in Mamaroneck, a working class village located about 25 miles north of New York City, was also defeated in federal court a few years ago. Earlier this year another southern California city, Costa Mesa, went to court to defend its anti-solicitation law which was challenged by a group of illegal immigrants who claim it’s unconstitutional and that it violates their civil rights. The outcome of that case has not been determined.