The Supreme Court decision upholding states' rights to offer sports betting was backed mostly by conservative justices, but it may also give a boost to California and other liberal states that are defying the Trump administration's drive for stricter immigration enforcement.

At issue on both fronts — sports betting and immigration — is whether Washington can require states to accept a federal policy, or instead, whether they are free to go their own way.

Monday's high-court opinion trumpeted the independence of the states.

The court struck down a federal law on sports wagering based on the constitutional principle that the federal government may not "commandeer" states and force them to carry out federal directives. The law did not make sports betting a federal crime, but instead told states they may not authorize the practice under their laws.

Under President Obama and other Democratic presidents, conservatives frequently invoked states' rights to block liberal measures coming out of Washington. Not surprisingly since President Trump's election, states' rights have been the first line of defense for the liberal states.

Legal experts say the court's strong endorsement of states and their independent role will surely play a role in the legal battles over immigration and so-called sanctuary cities. At issue there is whether states must cooperate with the federal government in detaining immigrants who are in the country illegally.

Ilya Sonim, a law professor at George Mason University, said the Supreme Court's decision in New Jersey's challenge to the sports-betting law "will be directly relevant" to how the courts decide the issue of sanctuary cities. The majority opinion by conservative Justice Samuel A. Alito Jr. "signals the justices are serious about the anti-commandeering rule and are suspicious of attempts to circumvent it."

But others noted that Alito and his colleagues gave no direct hint of how they would decide a case involving immigration enforcement or sanctuary cities. The Constitution makes federal law the "supreme law of the land," Alito said, but this does not include the power "to issue direct orders to the states."

"The anti-commandeering doctrine may sound arcane," Alito explained in Murphy vs. NCAA, "but it is simply the expression of a fundamental structural decision incorporated into the Constitution, the decision to withhold from Congress the power to issue orders directly to the states."

In the past, the court has said states and local officials may not be required to carry out a federal regulatory policy. In 1997, for example, the court said county sheriffs in Montana could not be forced to conduct background checks for gun buyers as required under the Brady Handgun Act. Alito cited that ruling.

Alito's opinion went a step further and said states may adopt "offending proposals" that contradict federal law. There was no question, he said, that New Jersey lawmakers had "authorized" betting on sports, even though federal law forbade them from doing so. Nonetheless, he said, the Constitution protects the states' right to make that choice.

Otherwise it is "as if federal officers were installed in state legislative chambers and were armed with the authority to stop legislators from voting on any offending proposals," he wrote. "A more direct affront to state sovereignty is not easy to imagine."

These words are likely to be cited in two immigration cases pending in California.

In March, Atty. Gen. Jeff Sessions went to Sacramento to announce he was suing California for adopting three laws that "reflect a deliberate effort … to obstruct enforcement of federal immigration laws."

"I understand that we have a wide variety of political opinions out there on immigration. But the law is in the books, and its purposes are clear and just," Sessions said in a speech to the California Peace Officers' Assn., referring to the federal laws. "There is no nullification. There is no secession. Federal law is the supreme law of the land."

He objected to a law that authorizes California officials to inspect immigration facilities where non-citizens are being held. A second state law limits how much information state and local officials will provide to federal agents concerning immigrants who are in custody. A third measure, probably the most controversial, forbids private employers from cooperating with federal immigration agents.

Sessions wants a federal judge to strike down all three laws because they are an "obstacle to the United States' enforcement of the immigration laws."

The federal-state conflict is also at issue in a suit over sanctuary cities and federal funds. Last year, the state sued Sessions for seeking to deny some law enforcement funding to sanctuary cities. The state said the Justice Department had no authority to add extra conditions to federal spending laws.

UC Davis law school Dean Kevin Johnson said the court's opinion in the New Jersey case gives support to California's legal claims, but it does not ensure they will prevail. "An argument can be made that the Trump administration, through executive order and otherwise, is attempting to commandeer state institutions in the name of immigration enforcement," he said. Alito's opinion "will offer support to the arguments that [California] Atty. Gen. [Xavier] Becerra is making in the sanctuary litigation."

The court's endorsement of states' rights was notable also because none of the justices, on the right or left, disagreed with the principle that Congress could not dictate to the states. Liberal Justice Elena Kagan joined Alito's opinion in full, as did Chief Justice John G. Roberts Jr. and Justices Anthony M. Kennedy, Clarence Thomas and Neil M. Gorsuch.

Three others — Justices Ruth Bader Ginsburg, Sonia Sotomayor and Stephen G. Breyer — would have upheld the ban on sports betting, but only because a separate part of the law also forbade individuals from sponsoring sports betting.