A Texas city’s ban on renting apartments to illegal immigrants “creates an additional restriction on alien residence,” according to a federal judge who ruled the ordinance unconstitutional because the authority to regulate immigration is exclusively a federal power.

It marks the third time that the Dallas suburb of Farmers Branch sees its measure to curb illegal immigration defeated in court. The city has paid millions to defend the law, passed by the council in 2006 and overwhelmingly approved by voters, and last year dished out nearly $500,000 to cover the legal fees of immigration advocates who challenged it.

In each legal defeat, federal courts have determined that the city cannot enforce immigration laws because only the federal government has the authority to do it. City leaders in Farmers Branch therefore violated the supremacy clause of the U.S. Constitution because they didn’t defer to the federal government on this particular immigration matter, according to a previous ruling.

The judge (George W. Bush-appointed Jane Boyle) who issued this week’s ruling took it a step further by saying that the Farmers Branch law creates an “additional restriction on alien residence in the city” by applying federal immigration classifications for purposes not authorized or contemplated by federal law. The judge also wrote that the measure “directly and substantially” regulates the residence of immigrants in Farmers Branch, which interferes with the uniform enforcement of federal immigration laws.

Like Farmers Branch, many other cities across the nation have spent hundreds of thousands of dollars to defend legal challenges to laws aimed at curbing illegal immigration. Some of the nation’s smaller municipalities have been forced to abandon their measures in order to avoid costly litigation.

The first was a southern New Jersey town (Riverside), which actually reversed a law that punished those who hire or rent to illegal aliens under threat of litigation by a notoriously liberal civil rights group. Others (in EscondidoCalifornia and HazletonPennsylvania) have been defeated in court. The mayor of Farmers Branch wants to appeal this latest ruling but a city council vote is required before proceeding