The supreme court on Monday suggested it may side with New Jersey in its effort to make sports gambling legal, a case that could make betting on football, basketball and other sports widely available.

The justices heard New Jersey’s challenge to a federal law that bars states from authorizing gambling in most professional and college sports. If the supreme court strikes down the law, giving sports betting the go-ahead, 32 states would likely make gambling on leagues such as the NFL and NBA legal within five years, according to a report by a California research firm.

The case pits New Jersey and other states against all four major US professional sports leagues, the NCAA and the federal government. The stakes are high. The American Gaming Association estimates that Americans illegally wager about $150bn on sports each year.

The NBA, NFL, NHL and MLB are arguing that striking down the law would hurt the integrity of their games, though leaders of all but the NFL have shown varying degrees of openness to legalized sports gambling.

More than a dozen states are supporting New Jersey, which argues that congress exceeded its authority when it passed a 1992 law that keeps states from authorizing sports betting. The state says the constitution allows congress to make wagering on sports illegal but that it can’t require states to keep sports gambling prohibitions in place.

Justices Elena Kagan and Sonia Sotomayor seemed to suggest that congress’ action was permissible. But other justices suggested that they would side with New Jersey. Justice Anthony Kennedy told Paul Clement, who was arguing for the sports leagues, that the law seemed like impermissible “commandeering,” or compelling the state to take an action.

Other justices suggested an interest in avoiding striking down the federal law as unconstitutional even if they side with New Jersey. Justice Neil Gorsuch told Ted Olson, who was arguing for New Jersey, that the court normally interprets statutes in a way to avoid the constitutional question if it can.

New Jersey’s governor, Chris Christie ,sat in the front row of the courtroom as the justices debated the case. His state has spent millions of dollars in legal fees trying to legalize sports betting. In 2012, with voters’ support, state lawmakers authorized betting on sports at the state’s casinos and racetracks. The action was a direct challenge to federal law.

The law barring sports gambling makes exceptions for Nevada, Montana, Oregon and Delaware, states that had approved some form of sports wagering before the law took effect. Nevada is the only state where a person can wager on the results of a single game, though the law doesn’t cover wagering between friends. In passing the law, congress gave New Jersey a year-long window to authorize sports betting at its casinos, but the state didn’t act.

Two decades later, when New Jersey decided to legalize sports betting, the four major professional sports leagues and the NCAA sued, but the state lost in court. In 2014, New Jersey tried a different tactic by repealing laws prohibiting sports gambling at casinos and racetracks. It lost again in court.

A decision is expected by the end of June.