For indispensable reporting on the coronavirus crisis, the election, and more, subscribe to the Mother Jones Daily newsletter.

On Wednesday, a federal judge temporarily blocked most of a controversial Texas law banning sanctuary cities. The law, Senate Bill 4, was set to go into effect on Friday, but key provisions will now be put on hold pending a final decision.

SB 4, which was signed by Texas Gov. Greg Abbott in May, effectively prohibits the existence of sanctuary cities by forcing local police to cooperate with federal immigration officials. SB 4 would also allow local officials to be fined up to $25,500 per day and face jail time if they refused to enforce the law.

Orlando Garcia, a federal judge in the Western District of Texas, ruled that Texas cannot stop local officials and college campuses from adopting or endorsing policies that limit enforcement of immigration laws. He also ruled that the state cannot require local jails to comply with US Immigration and Customs Enforcement (ICE) requests to detain people past their release date.

A section of the law that gives police the authority to ask people about their immigration status will still be allowed to go into effect, according to the ruling. Civil liberties groups have warned that the provision, which has been compared to the Arizona’s severe “show me your papers” law, will cause undocumented immigrants to be detained as part of routine interactions like traffic stops. Unlike the largely abandoned Arizona law, SB 4 does not require police officers to investigate people’s immigration status if there is a “reasonable suspicion” that they are in the country illegally.

Garcia wrote in his decision that there “is overwhelming evidence by local officials, including local law enforcement, that SB 4 will erode public trust and make many communities and neighborhoods less safe. There is also ample evidence that localities will suffer adverse economic consequences which, in turn, harm the State of Texas.”

He also wrote that while the state legislature can ignore the “knowledge and experience” of local officials, it cannot “exercise its authority in a manner that violates the United States Constitution.”

Immigrant advocates celebrated the decision as a major victory. “The court was right to strike down virtually all of this patently unconstitutional law,” Lee Gelernt, the ACLU lawyer who argued the case against SB 4, said in a statement. “Senate Bill 4 would have led to rampant discrimination and made communities less safe.”

But advocates warn that the fight isn’t over yet. Abbott said on Wednesday night that the state will appeal the decision immediately.

