Republican Gov. Greg Abbott signed Senate Bill 4 into law in a Facebook broadcast May 7, sparking outrage from cities across the state, immigrants’ rights activists, and even some police officers. The law, similar in many respects to Arizona’s infamous 2010 “Show Me Your Papers” law, requires local law enforcement agencies to comply with all immigration detainer requests to transfer detained immigrants to Immigration and Customs Enforcement custody. It also bars municipalities and local and campus police from prohibiting cooperation with federal immigration authorities. The law specifically requires local entities to allow officers to ask those they arrest or lawfully detain about their immigration status, to share information and cooperate with immigration authorities, and to allow immigration authorities into jails.

The ACLU challenged the law on constitutional grounds. Just a little over 24 hours before it would have gone into effect, a federal judge temporarily blocked it pending the resolution of the lawsuit.

When a storm like Hurricane Harvey hits, it’s not easy for impacted communities to get back on their feet. In addition to dealing with the potential mental and physical trauma that comes with the storm, they have to assess damage to their houses and cars and file endless insurance claims. But in Texas, where 1.7 million people are immigrants without proper legal documents, there was one more thing to worry about: an anti-immigrant law that would outlaw so-called sanctuary cities was set to kick in Friday, September 1.

The American Civil Liberties Union and the ACLU of Texas filed a lawsuit in a San Antonio federal district court in June to block SB 4, arguing that it is unconstitutional and will lead to racial profiling. In a 94-page opinion issued Wednesday night, U.S. District Judge Orlando L. Garcia largely agreed, finding that the plaintiffs were likely to succeed on most of their claims against the state, noting that his ruling merely preserves the status quo until the case is decided on its merits.

“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,” Garcia wrote. “There is also ample evidence that localities will suffer adverse economic consequences which, in turn, harm, the State of Texas. Indeed, at the end of the day, the Legislature is free to ignore the pleas of city and county officials, along with local police departments, who are in the trenches and neighborhoods enforcing law on a daily and continuing basis. The depth and reservoir of knowledge and experience posesed by local officials can be ignored. The Court cannot and does not second guess the Legislature. However, the State may not exercise its authority in a manner that violates the United States Constitution.”

The penalties and the nature of the law will “further erode trust between the police and the communities they serve” because police “will undoubtedly racially profile Hispanic or Latino people” and “they will improperly apply the law for fear of being seen as weak on immigration enforcement,” the ACLU wrote last Thursday.

As Hurricane Harvey approached Texas last week, immigrants without proper legal documents expressed fears they would be detained if they sought help, spurring statements from Abbott, the Federal Emergency Management Agency, ICE, and Customs and Border Protection that immigration enforcement operations would not be carried out at shelters. On Monday, when asked about how SB 4 would impact immigrants already traumatized by the hurricane, Houston Mayor Sylvester Turner said he himself would represent those who get swept up, if any did.

“There is absolutely no reason why anyone should not call [for help]. And I and others will be the first ones to stand up with you,” Turner, who is an attorney, told reporters Monday. “If someone comes and they require help and then for some reason tries to deport them, I will represent them myself.”

The mayor’s comments were “very refreshing and very welcome,” said Cesar Espinosa, executive director of Immigrant Families and Students in the Struggle, which goes by its Spanish acronym, FIEL, a Houston-based group that helps unauthorized immigrants in the city’s Latino community. Still, many people feared that, come Friday, government officials would begin to request immigration papers from those seeking shelter, said Espinosa, who was trying to assuage those concerns throughout the week. “Our messaging to people is if they need help, to look for it,” he told The Intercept on Wednesday.

The law’s negative effects on public safety are already evident. As The Intercept previously reported, Texas saw a significant decrease in crime reporting by Hispanics as far back as April, when the bill was still being debated. The law will be triggered only when an individual comes in contact with law enforcement, but that means that even a routine traffic stop can lead to an immigration-related arrest.

“[The plaintiffs] fear the discriminatory environment that SB 4 will create, including the increased risk of racial profiling by local police officers who, due to their lack of training, may use skin color or language as a proxy for immigration status — a possibility that SB 4 actually encourages because of the onerous consequences it imposes for failing to toe the line on its broad edicts,” the litigants argued in their motion to block SB 4.

Oscar Hernandez, an organizer with United We Dream Houston, said the voices of communities who objected to the Texas legislature’s passage of a “racist law” were heard. “I know today that this moment belongs to the powerful communities across the state who organized and demanded mayors, city councils, police chiefs and sheriffs to bring this legislation, to defy SB 4 and to protect all residents who are organizing to rebuild the lives and livelihoods of the communities impacted by Hurricane Harvey,” he said to reporters on Thursday.

“This was an astounding defeat for the state’s attempt to conscript local officers to become deportation agents,” said Andre Segura, legal director at the ACLU of Texas, adding that the temporary injunction is the first step toward the repeal of the law. “We will continue to be very vigilant.”

Update: Aug. 31, 2017

This story was updated to reflect the ACLU’s victory in court Wednesday night.