A federal judge in San Antonio on Wednesday blocked key provisions of the Texas law that imposes a ban on the so-called sanctuary cities two days before it was set to take effect.

In the temporary ruling, United States District Orlando Luis Garcia granted a preliminary injunction of Senate Bill 4 preventing the law from being enforced, while a lawsuit challenging the bill continues to pave its way through federal courts.

The 94-page ruling by the federal judge prevents Texas from implementing the most controversial provisions of Senate Bill 4 (SB 4). The law prevents cities and counties from adopting policies that limit immigration enforcement and permit police officers to interrogate the immigration status of anyone they plan to detain or arrest.

The main provision that was blocked by the judge threatened police officers and officials who violated the law with removal from office, jail time or fine. It also directed local governments to cooperate with immigration detainer requests from the Immigration and Customs Enforcement, which in turn would allow the detainees to be transferred to federal custody, Fox News reported.

“The best interest of the public will be served by preserving the status quo and enjoining, prior to Sept. 1, the implementation and enforcement of those portions of SB 4 that, on their face, are preempted by federal law and violate the United States Constitution,” Garcia wrote in his Wednesday ruling, according to mysanantonio.com.

Garcia, who was appointed by former President Bill Clinton in November 1993, wrote in his Wednesday ruling: "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 added.

Garcia has been serving as the chief judge of the United States District Court for the Western District of Texas since 2016. He is a native of Jim Wells County, Texas, and he completed his graduation from the University of Texas in 1975. He completed his Juris Doctor (J.D.) in 1978 from the University of Texas School of Law, according to his profile on the government website, Federal Judicial Center.

He was confirmed by the United States Senate on March 10, 1994, and received his commission on March 11, 1994. He filled the seat vacated by Emilio Garza. The American Bar Association had rated him "Unanimously Qualified" for the nomination, according to Ballotpedia.org, a nonpartisan online encyclopedia.

In order to obtain an injunction to the law, the local governments and organizations challenging the SB 4 were required to prove they were harmed by it. The decision by the judge on Wednesday can be appealed to the Fifth Circuit Court of Appeals in New Orleans.

“We won over 90 percent of it,” said Luis Vera, a lawyer for the League of United Latin American Citizens, which represented the border city of El Cenizo in the lawsuit, according to mysanantonio.com. “The state cannot mandate to the cities or police officers or sheriff’s offices how they run their police departments.”

Garcia's ruling also marked a victory for immigrant rights groups and several local governments, including those in Houston, Austin, San Antonio and El Cenizo, which had argued that the law unconstitutionally requires police officers to perform the duty of federal authorities and might lead to racial profiling, according to the Huffington Post.

The law had been supported by President Donald Trump's administration. Attorney General Jeff Sessions also threatened to pull away funding from jurisdictions that attempt to damage communications among local police authorities and federal immigration authorities, according to Fox News.