Updated, 10:38 a.m.: To include a statement from MALDEF, one of the plaintiffs.

AUSTIN — A federal appeals court ruled Tuesday that most of Texas' "sanctuary cities" law can remain in effect while the legal battle continues in a lower district court, a major victory for the state.

With the exception of a statute that would punish local officials for endorsing policies that limit federal immigration enforcement, the 5th U.S. Circuit Court of Appeals allowed the rest of the law to stand.

The court blocked that section of the law because it deemed the word "endorse" to be too broad and risked subjecting local officials to punishment for speaking out against the law, a violation of the First Amendment guarantee to free speech. Officials who act on limiting federal immigration enforcement, however, are still subject to punishment.

"With one exception, SB 4's provisions do not, on their face, violate the Constitution," the court's opinion reads.

Under the law Gov. Greg Abbott signed last May, police in the state can ask anyone they detain about their immigration status. Jurisdictions that violate the law are subject to fines of up to $25,000 a day and local officials who break the law can be removed.

Tuesday's ruling comes after Attorney General Ken Paxton challenged a San Antonio district judge's decision to temporarily block the law in August, two days before it was supposed to go into effect. Plaintiffs in the case used the state's appeal to argue that the law should be blocked entirely.

In September, a separate three-judge panel from the appeals court allowed parts of the law to proceed. Since then, the state has implemented the law on a limited basis and began accepting residents' complaints.

Tuesday's decision from the traditionally conservative 5th Circuit lets most of the law remain in effect until the San Antonio district court can fully resolve the case.

Texas officials celebrated the ruling.

"Texas Ban on Sanctuary City Policies upheld by Federal Court of Appeals," Abbott tweeted. "Allegations of discrimination were rejected. Law is in effect."

BREAKNG: Texas Ban on Sanctuary City Policies upheld by Federal Court of Appeals. Allegations of discrimination were rejected. Law is in effect. — Greg Abbott (@GregAbbott_TX) March 13, 2018

Paxton praised the ruling in a prepared statement.

"I'm pleased the 5th Circuit recognized that Senate Bill 4 is lawful, constitutional and protects the safety of law enforcement officers and all Texans," Paxton said. "Enforcing immigration law prevents the release of individuals from custody who have been charged with serious crimes. Dangerous criminals shouldn't be allowed back into our communities to possibly commit more crimes."

Lee Gelernt, deputy director of the ACLU's Immigrants' Rights Project, who argued the case before the appeals court, said the plaintiffs are exploring their legal options, which could include appealing the decision to the Supreme Court.

"The court made clear that we remain free to challenge the manner in which the law is implemented, so we will be monitoring the situation on the ground closely," he said in a written statement. "We are also pleased that the court narrowed the law in certain respects."

The plaintiffs include all of Texas' largest cities, including Dallas, as well as several counties and civil rights organizations.

Thomas Saenz, president and general counsel for the Mexican American Legal Defense and Education Fund, which represented some of the plaintiffs, said he was disappointed but noted that it was a temporary decision reached by a three-judge panel, not the full 5th Circuit.

He said there are opportunities to develop their arguments against the law before the district court reaches a final decision, as well as options to revisit Tuesday's ruling by the full 5th Circuit and the Supreme Court.

"In short, the battle against SB 4 is far from over," Saenz said in a prepared statement. "We remain confident that this horrific law will ultimately find its rightful place in the dustbin of history."

In its opinion, the court came down hard on the plaintiffs' arguments that Texas' sanctuary cities law is preempted by federal immigration law and that it violates the First, Fourth and Fourteenth Amendments of the Constitution.

The court ruled that while federal statutes create a highly regulated scheme for cooperation between federal immigration authorities and local entities, they "also expressly allow[s] cooperation in immigration enforcement outside those agreements," which allows for the type of cooperation the sanctuary cities law encourages.

"Federal law regulates how local entities may cooperate in immigration enforcement; SB4 specifies whether they cooperate," the opinion reads.

The judges also shot down the idea that the law compels local police officers to enforce immigration law without training. They pointed to a statute in the law specifying that the local assistance must occur "with a federal immigration officer as reasonable or necessary" and said it does not permit local officials to act without federal direction or supervision.

The court also relied on previous rulings concerning Arizona's 'papers please' law to let stand the Texas law's provision on sharing information with federal authorities and allowing officers to ask about immigration status.

"If anything, the statute in Arizona seems more problematic because it mandates status inquiries where SB 4 merely forbids preventing those inquiries," the opinion reads.

The judges upheld the statute that says local jails must comply with requests from immigration authorities to hold unauthorized immigrants for them and chastised plaintiffs for challenging that part of the law before it was to go into effect in September.

The court ruled that it was not enough for plaintiffs to say that the requests would sometimes violate the Fourth Amendment, which prohibits unreasonable search and seizure. They needed to prove it would happen every time.

"They have not satisfied this exacting standard," the judges wrote.

The plaintiffs also lost their argument that the part of the law banning policies that "materially limit" immigration enforcement was too vague and should be invalidated because the law already prohibits interfering in enforcement.

"Almost any limitation could be recharacterized as a partial prohibition," the court wrote. "That is likely why SB4 includes both terms. Otherwise, supporters of the policies just described could argue that their policies limited but did not actually prohibit immigration enforcement."