A U.S. District Judge ruled in favor of the NCAA and four major professional sports leagues Friday and issued a permanent injunction to prevent New Jersey casinos and racetracks from offering sports betting.

Judge Michael Shipp wrote that New Jersey's latest efforts -- the 2014 Sports Wagering Law -- violates the Professional and Amateur Sports Protection Act of 1992.

Shipp heard oral arguments from both sides Thursday in Trenton, New Jersey, before releasing his decision just hours before a temporary restraining order that stopped the state's thoroughbred track Monmouth Park from opening its sports book was set to expire.

An adviser for Darby Development LLC, operators of Monmouth Park Racetrack (above), said Friday that U.S. District Judge Michael Shipp's ruling was not terribly surprising. AP Photo/Bill Denver

It's the latest of many setbacks for New Jersey in its two-year legal battle with the NCAA, NFL, NBA, NHL and MLB. The state believes sports betting can help revive its struggling casino and horse racing industries. The sports leagues have argued that it will damage fans' perception of the integrity of their games, although NBA commissioner Adam Silver recently said expanded legalized sports betting in the United States is inevitable.

New Jersey will file an appeal within days, State Senator Raymond Lesniak told ESPN.

"We continue to believe that New Jersey has the right to allow sports betting in the state and we will keep up the fight in court," State Senate President Steve Sweeney said in a statement. "We are going to continuing pursuing every legal option available. The economic impact that sports wagering can have on New Jersey is far too important to simply shrug our shoulders and move on."

The state believes it has a much better chance in the Third Circuit Court of Appeals, which ruled against New Jersey by a 2-1 majority decision in September 2013. During that appeal, as New Jersey attorneys argued that the federal prohibition on sports betting unconstitutionally commandeered states, Third Circuit Court judges said states are free to repeal sports betting laws and decide "the contours of the prohibition."

New Jersey used that language to create the 2014 Sports Wagering Law, which Gov. Chris Christie signed in early October. The Sports Wagering Law partially repeals the state's prohibition on sports betting, but restricts the activity to casinos and racetracks, where private entities would oversee it. The law also adds an age requirement and prohibits bets on any games involving New Jersey universities or collegiate games played in the state.

The sports leagues pointed to those stipulations and argued that New Jersey's law is a de facto authorization and still violates PASPA, which prohibits state-sponsored sports betting in all but four states: Nevada, Delaware, Montana and Oregon.

"Obviously we're disappointed, but not terribly surprised," said Dennis Drazin, adviser to Darby Development LLC, operators of Monmouth Park Racetrack. "After analyzing the rationale expressed by the Court in granting a temporary restraining order last month, today's action was rather expected. We will once again return to the Third Circuit Court of Appeals and ask that they order strict adherence to their 2013 decision, which established the roadmap for New Jersey to begin offering sports wagering.

"For now, it's status quo. Nevertheless, we remain confident that the Third Circuit will render a favorable result for Monmouth Park."

Daniel Wallach, a gaming and sports law attorney with Becker & Poliakoff, attended Thursday's oral arguments and came away believing that the case's outcome will be determined by what the Third Circuit meant by saying the state can decide the exact contours of the prohibition.

"The answer to that question will decide whether New Jersey wins or loses," Wallach said. "New Jersey has a much better chance in the Third Circuit, but the leagues remain the favorites."

When asked by Shipp what the Third Circuit meant by allowing the state to define contours during Thursday's hearing, Jeffery Mishkin, an attorney for the sports leagues, said the state could determine the penalties related to sports betting.

Shipp agreed with Miskin and ruled that PASPA allows states only to completely repeal sports betting prohibitions in order not to violate the 22-year-old federal statute. While the judicial battle continues, Silver is looking to start the discussion about a change to the sports betting laws in the U.S.

In an op-ed in the New York Times last week, Silver called for Congress to create a federal framework that would allow states to legalize, regulate and monitor sports betting.

"But I believe that sports betting should be brought out of the underground and into the sunlight where it can be appropriately monitored and regulated," Silver wrote.

The sports leagues also are embracing daily fantasy sports, with the Denver Broncos, Los Angeles Lakers and Golden State Warriors the latest teams to partner with daily fantasy operators.