Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

AUSTIN, Texas — A federal judge late Wednesday temporarily blocked most of Texas' tough new "sanctuary cities" law that would have allowed police to inquire about people's immigration status during routine interactions such as traffic stops.

The law, SB 4, had been cheered by President Donald Trump's administration but decried by immigrants' rights groups who say it could force anyone who looks like they might be in the country illegally to "show papers."

The measure sailed through the Republican-controlled Legislature despite months of protests and opposition from business groups who worried that it could cause a labor-force shortage in industries such as construction. Opponents sued, arguing it violated the U.S. Constitution, and U.S. District Judge Orlando Garcia's ruling in San Antonio keeps it from taking effect as planned Friday — allowing the case time to proceed.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

In a 94-page ruling, Garcia wrote 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" and that "localities will suffer adverse economic consequences which, in turn, will harm the state of Texas."

"The Court cannot and does not second guess the Legislature," he continued. "However, the state may not exercise its authority in a manner that violates the United States Constitution."

Related: Cops Resist Texas Push to Join Immigration Crackdown

Garcia's order suspends the law's most contentious language while suggesting that even parts of the law that can go forward won't withstand further legal challenges.

The law had sought to fine law enforcement authorities who fail to honor federal requests to hold people jailed on offenses that aren't immigration related for possible deportation. It also would have ensured that police chiefs, sheriffs and constables could face removal from office and even criminal charges for failing to comply with such federal "detainer" requests.

AG Paxton Vows to Defend the Constitutionality of Senate Bill 4 https://t.co/n3IetRTJ2D — TX AG's Office (@TXAG) August 31, 2017

The four largest cities in Texas — San Antonio, Austin, Houston and Dallas— have joined the lawsuit, saying the law is vague and would have a chilling effect on immigrant communities. Their attorneys told Garcia that his ruling could determine if other states pursue copycat measures. Lawyers for the Texas attorney general's office responded that the new law has fewer teeth than Arizona's 2010 "Show Me Your Papers" measure that was partially struck down by the U.S. Supreme Court.

FILE - In this June 26, 2017, file photo, Lydia Balderas, left, and Merced Leyua, right, join others as they protest against a new sanctuary cities bill outside the federal courthouse in San Antonio. Eric Gay / AP

Top conservatives say an immigration crackdown is necessary to enforce the rule of law. Republican Gov. Greg Abbott has maintained that only lawbreakers have anything to worry about.

On the final day of the legislative session in May, tensions boiled over when Republican state Rep. Matt Rinaldi told Democrats that he had called federal immigration agents to report protesters in the Capitol who held signs saying they were illegally in the country. One Democratic legislator admitted pushing Rinaldi, who responded by telling one Democrat that he would "shoot him in self-defense."

A federal court has struck down virtually all of Texas' anti-immigrant law #SB4. Read our full statement: https://t.co/QEW4EXFdUS pic.twitter.com/ElZGN26u4L — ACLU of Texas (@ACLUTx) August 31, 2017

The Trump administration has made "sanctuary cities" a target. U.S. Attorney General Jeff Sessions has threatened to pull federal money from jurisdictions that hinder communication between local police and immigration authorities and has praised Texas' law.