Update, 3:46 p.m. Sept. 5: Revised to reflect the attorney general's appeal to the 5th Circuit Court of Appeals.

A federal district judge in San Antonio blocked significant portions of Texas' sanctuary cities ban last Wednesday, two days before the law was set to go into effect — a significant blow to Gov. Greg Abbott, who said the state would appeal.

In a 94-page ruling, U.S. District Judge Orlando Garcia blocked provisions in the law that required local law enforcement departments to comply with federal requests to hold unauthorized immigrants in their custody. He also blocked a part of the law that said local departments couldn't implement policies that would "materially limit" the enforcement of immigration laws.

Garcia echoed the concerns of local officials and law enforcement leaders who had said the law would put their communities at risk and make their jobs more difficult.

"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," he wrote, referring to Senate Bill 4.

Abbott and other Republican lawmakers had said the law would stand up to scrutiny and do the opposite — increase public safety. Abbott had targeted Travis County Sheriff Sally Hernandez for implementing a so-called sanctuary city policy.

"Today's decision makes Texas' communities less safe," Abbott said in a written statement. "Because of this ruling, gang members and dangerous criminals, like those who have been released by the Travis County Sheriff, will be set free to prey upon our communities."

The order did not block a portion of the law that allows police officers to ask people's immigration status during any legal detention, but it limited the actions officers can take after learning that a person is undocumented. Officers can only report the person's immigration status to federal authorities.

"In sum, SB 4 gives local officers discretion to inquire and share information but it does not provide them with discretion to act upon the information that they may obtain," Garcia wrote in a footnote.

The U.S. Supreme Court upheld a similar measure, which some call a "show me your papers" provision, in a case about a 2010 Arizona law that is still in effect.

"U.S. Supreme Court precedent for laws similar to Texas' law are firmly on our side," Abbott said. "This decision will be appealed immediately and I am confident Texas' law will be found constitutional and ultimately be upheld."

Attorney General Ken Paxton almost immediately filed an appeal to the district court. He also asked to have the lawsuits against Senate Bill 4 consolidated and moved from Garcia's court in San Antonio to Austin, "where the people's representatives passed SB 4," he said in a written statement. "State business is conducted in Austin. The plaintiffs have no reason to litigate this case in San Antonio."

On Sept. 5, Paxton filed a motion to stay the lower court's ruling with the U.S. 5th Circuit Court of Appeals. He asked the appeals court to issue a ruling within two days.

"The district court's fundamentally flawed holding that states violate the Fourth Amendment by even voluntarily honoring federal ICE detainer requests threatens to shut down federal-local cooperation that has existed throughout the nation since the 1940s," Paxton said in his motion. "The district court's order should be immediately stayed pending appeal, as this injunction has far reaching public safety consequences. Senate Bill 4 is wholly valid, and the state has every right to prohibit its own localities from having sanctuary city policies."

Rep. Matt Krause, R-Fort Worth, said he was not surprised by the ruling but was confident the law would be upheld by the Supreme Court.

"They can find a judge to invalidate what they want to," Krause said. "The product we approved was constitutionally sound and was based on precedent. It's a good law and I'm confident it will be upheld."

Rep. Matt Shaheen, R-Plano, said Texas would ultimately prevail.

"For a federal judge to interfere with Texas law requiring our law enforcement to honor detainers approaches legal malpractice and endangers our citizens," Shaheen said.

The plaintiffs in the case — which include the state’s largest cities, as well as several counties and civil rights organizations — celebrated Garcia’s ruling. They had argued that the sanctuary cities ban violated the Constitution and would cause them irreparable harm if it were allowed to go into effect.

"It's a win for the country," Roger Rocha, president of the League of United Latin American Citizens, one of the lead plaintiffs in the case, said in a written statement. "The ruling protects the civil liberties of immigrant communities across the U.S. that live in fear of discrimination due to the color of their skin, accent, and native country. We prevailed in blocking state lawmakers from rolling back decades of progress our nation has made on civil rights."

"SB4 was never about making us safer," Democratic state Rep. Rafael Anchia of Dallas, who chairs the Mexican American Legislative Caucus, said in a written statement. "Proponents of SB4 failed to grasp the detrimental impact this bill will have on every community in Texas. We thank the court for once again stepping in to uphold the constitution and protect Texans from discrimination."

Democrats have made repealing the sanctuary cities law their top priority and said Republicans' fervor to implement it is evidence of their hostility toward minority voters.

"My constituents had genuine fear about this law going into effect," said state Rep. Chris Turner of Arlington, who chairs the House Democratic Caucus. "Hopefully they can breathe a little easier."

Turner said the order signals that the judge thinks the law could violate the U.S. Constitution and the civil rights of Texans.

"That's what myself and other Democrats and other Democrats in the Legislature argued this past spring, that it was not only unnecessary but would violate Texans' constitutional rights," Turner said. "I'm thrilled with Judge Garcia's order today."

Dallas Mayor Mike Rawlings said the ruling was the first victory in a continuing fight.

"I'm pleased with the ruling, which allows our Dallas police officers and local law enforcement officers across the state to focus on their jobs of protecting our neighborhoods," Rawlings said. "SB 4 is an unconstitutional unfunded mandate that would make our city less safe. We still have a ways to go to defeat this misguided legislation, but the people of Dallas should rest easier knowing that many of the provisions of this overreaching law will not take effect this Friday."