On Monday, the Supreme Court struck down a federal law that prevented states from legalizing sports betting in Murphy v. NCAA. The ruling struck a blow against federal overreach and restored to states the power to set their own policies related to gambling.

The court ruled 7-2, with Justice Stephen Breyer joining all but one part of the majority opinion. Justice Ruth Bader Ginsburg dissented, joined by Justice Sonia Sotomayor and, in part, Breyer.

For the past half-century, most states have barred sports betting, and in 1992, Congress passed the Professional and Amateur Sports Protection Act, which makes it unlawful for states to “sponsor, operate, advertise, promote, license, or authorize by law … a lottery, sweepstakes, or other betting, gambling, or wagering scheme based” on competitive sports.

In short, the law prevented states from passing new laws or repealing old ones, with the goal of keeping sports betting illegal in most states. The law grandfathered in four states (including Nevada) and also gave the state of New Jersey a one-year window to legalize sports betting.

New Jersey waited until 2011, when the voters passed a constitutional amendment authorizing the state Legislature to legalize sports betting in Atlantic City. When the Legislature passed such a law in 2012, the NCAA and professional sports leagues immediately challenged it, and a federal district court halted its implementation under the Professional and Amateur Sports Protection Act.

Then in 2014, the state tried another tactic. The Legislature passed a law repealing an earlier law that barred sports betting. Under the new law, betting would be allowed in Atlantic City for sporting events that did not take place in New Jersey or involve New Jersey collegiate teams.

The NCAA and professional sports leagues challenged the 2014 law—and that’s the subject of the Supreme Court’s ruling in Murphy v. NCAA.

>>> Listen to “SCOTUS 101”: Elizabeth Slattery and Tiffany Bates bring you up to speed on their Supreme Court podcast.

The court agreed with New Jersey that the federal law violates the Constitution.

Writing for the majority, Justice Samuel Alito explained that the 10th Amendment of the Constitution “with[e]ld from Congress the power to issue orders directly to the States.” Known as the anti-commandeering doctrine, this structural constitutional principle holds that Congress may not force states into the service of the federal government.

As the court explained in New York v. United States (1992), a case dealing with states’ disposal of radioactive waste, while Congress may incentivize states to pass certain laws, the Constitution does not allow Congress to override states’ sovereignty to regulate the private conduct of their own citizens.

Certainly, Congress can take a “carrot or stick” approach to encourage states to enact federal priorities. But Congress can’t force state governments to enact its preferred policies.

The Professional and Amateur Sports Protection Act violates this principle because, as Alito wrote, it “unequivocally dictates what a state legislature may and may not do.” Indeed, he asserted that a “more direct affront to state sovereignty is not easy to imagine.” Alito compared it to federal officers being placed in statehouses across the country “armed with the authority to stop legislators from voting on any offending proposals.”

He further explained:

The legislative powers granted to Congress are sizable but they are not unlimited. The Constitution confers on Congress not plenary legislative power but only certain enumerated powers. Therefore, all other legislative power is reserved for the States, as the Tenth Amendment confirms. And conspicuously absent from the list of powers given to Congress is the power to issue direct orders to the governments of the States.”

The court also rejected the claim that the Professional and Amateur Sports Protection Act pre-empted state law in this area. Alito quickly knocked down that argument, explaining that in order to pre-empt state law, a federal law must be based on “the exercise of a power conferred to Congress by the Constitution” and regulate private actors, not the states. The Professional and Amateur Sports Protection Act fails on both accounts.

Alito concluded that Congress could regulate sports betting directly, but having chosen not to, “each state is free to act on its own.”

A dozen or so states were already considering legalizing sports betting, and this ruling gives them the green light. But it could also have an impact far beyond the sports world—in the legal battle between the Trump administration and sanctuary cities, and in conflicts between states and the federal government over legalizing marijuana.