Melanie Eversley

USA TODAY

A federal judge has temporarily blocked Texas' "sanctuary cities" law backed by the Trump administration that would have allowed police to inquire about immigration status, the Austin American-Statesman reported.

The ruling by U.S. District Judge Orlando Garcia halts the planned implementation Friday of Senate Bill 4, according to the American-Statesman.

The law allows local law enforcement to ask anyone who is legally detained or arrested for their immigration status during routine interactions such as traffic stops, the Los Angeles Times reported.

Garcia granted the preliminary injunction after five Texas cities, several counties and sheriffs challenged the law's constitutionality.

The judge wrote in his 94-page order that there is "overwhelming evidence" that the law "will erode public trust and make many communities and neighborhoods less safe," the Los Angeles Times reported.

Garcia also wrote that "localities will suffer adverse economic consequences which, in turn, will harm the state of Texas.”

Immigrants' rights groups complained that the measure could force anyone who looks as if they are in the country illegally to "show papers."

More:Chicago files lawsuit over rules targeting sanctuary cities

Related:Cities take Texas to court over immigration, sanctuary cities law

The law easily passed Texas' Republican-controlled legislature despite months of protests and opposition from business groups that worried it could cause a labor-force shortage in construction and other industries.

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 legislation had sought to fine law enforcement authorities who fail to honor federal requests to detain people jailed on offenses that aren’t immigration related. It also would have ensured that police chiefs, sheriffs and constables could be removed from office and even face criminal charges for failing to comply with such federal “detainer” requests.

The four largest cities in Texas – San Antonio, Austin, Houston and Dallas – joined the lawsuit, charging the law is vague and would discourage immigrant communities from working with local law enforcement on public safety issues. Lawyers for the Texas attorney general’s office said 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.

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.”

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.

Contributing: The Associated Press