Tom Brady and the players’ union have beaten the NFL in court, putting one of the sport’s biggest stars back on the field when the season opens next week after a contentious and polarizing battle with the league.

U.S. District Judge Richard M. Berman overturned the league’s four-game suspension of Brady, the four-time Super Bowl-winning quarterback for the New England Patriots, in the long-running DeflateGate case. Berman’s ruling was released Thursday.

“Based upon the foregoing and applicable legal authorities, the Court hereby denies the [NFL] Management Council’s motion to confirm the Award and grants the Players Association’s motion to vacate the Award, thereby vacating the four-game suspension of Tom Brady, effective immediately,” Berman wrote.

The decision makes Brady eligible to play next Thursday against the Pittsburgh Steelers in the NFL’s season-opening game.

The NFL, however, announced that it will appeal the ruling. The NFL’s appeal will be made to the U.S. Court of Appeals for the Second Circuit.

“We are grateful to Judge Berman for hearing this matter, but respectfully disagree with today’s decision,” NFL Commissioner Roger Goodell said in a written statement released by the league. “We will appeal today’s ruling in order to uphold the collectively bargained responsibility to protect the integrity of the game. The commissioner’s responsibility to secure the competitive fairness of our game is a paramount principle, and the league and our 32 clubs will continue to pursue a path to that end. While the legal phase of this process continues, we look forward to focusing on football and the opening of the regular season.”

The NFL’s appeal will not keep Brady off the field. The league has no plan to seek a stay of the ruling reinstating Brady, an NFL official said, meaning that Brady will remain eligible to play during the appeal process. The league’s appeal does mean that Brady potentially is risking having to serve the suspension, if it is reinstated via the appeal, later this season or perhaps beyond. The NFL also seems intent on doing its best to avoid having Berman’s ruling stand as a precedent for future cases of player discipline.

Legal experts had said that Brady and the NFL Players Association faced a difficult task in court because judges generally are reluctant to overturn arbitration decisions. Goodell upheld Brady’s four-game suspension on appeal. The league had imposed the penalty after its investigator, Ted Wells, found that Brady probably was aware of a scheme to use under-inflated footballs during the first half of last season’s AFC title game against the Indianapolis Colts.

The league argued in court that Goodell’s authority in the matter could not be challenged under the terms of the collective bargaining agreement between the league and the union. But the NFLPA contended that Goodell acted improperly, and Berman agreed.

Berman cited in particular the league’s failure to notify Brady that he faced a potential suspension, and the NFL’s failure to allow league counsel Jeff Pash to testify at Brady’s appeal hearing.

“The Court is fully aware of the deference afforded to arbitral decisions, but, nevertheless, concludes that the Award should be vacated,” Berman wrote. “The Award is premised upon several significant legal deficiencies, including (A) inadequate notice to Brady of both his potential discipline (four-game suspension) and his alleged misconduct; (B) denial of the opportunity for Brady to examine one of two lead investigators, namely NFL Executive Vice President and General Counsel Jeff Pash; and (C) denial of equal access to investigative files, including witness interview notes.”

Berman had urged the two sides to reach a settlement in the case, to no avail. He had questioned the NFL particularly sharply in court. Legal experts had warned against reading too much into Berman’s courtroom approach, saying it could have been a strategy aimed at trying to get the league to feel uneasy enough to settle. Instead, Berman’s questioning of the league in court was a preview of his ruling.

“Goodell’s reliance on notice of broad CBA ‘conduct detrimental’ policy – as opposed to specific Player Policies regarding equipment violations – to impose discipline upon Brady is legally misplaced,” Berman wrote.

The NFL also had cited Brady’s lack of cooperation with Wells’s investigation in imposing the suspension, highlighting the fact that the quarterback ordered his cell phone destroyed around the time he met with investigators.

The defeat represents the NFL’s latest loss to the union over disciplinary measures. Last year, a former federal judge, Barbara S. Jones, overturned the league’s indefinite suspension of Ray Rice after being appointed by Goodell to hear the running back’s appeal.

The union went to federal court in Minnesota after arbitrator Harold Henderson upheld the league’s suspension of Minnesota Vikings running back Adrian Peterson. U.S. District Judge David S. Doty ruled in the union’s favor, sending Peterson’s case back to the league for further proceedings under the CBA.

Henderson reduced the league’s suspension of defensive end Greg Hardy, now with the Dallas Cowboys, from 10 to four games on appeal.

The union agreed in the sport’s most recent labor deal to allow Goodell to retain his power to hear appeals in certain player disciplinary cases, including those that fall under the sport’s personal conduct policy and those involving integrity-of-the-game issues. But the NFLPA has pushed since then for independent arbitration in such cases.

The union filed a grievance after the owners of the 32 NFL teams last year ratified a new personal conduct policy, which puts initial disciplinary decisions in the hands of another league official but keeps Goodell in charge of resolving appeals.

Eric Winston, the veteran offensive lineman for the Cincinnati Bengals who is the president of the union, said recently he cannot envision players agreeing to another labor deal without Goodell’s power to hear appeals in disciplinary cases being curbed.

Goodell has said the owners do not want him to surrender such authority. But Patriots President Jonathan Kraft said recently that it might be time for the league to rethink the disciplinary process. Kraft’s father, Patriots owner Robert Kraft, has been critical of the league’s handling of the DeflateGate case. In addition to Brady’s suspension, the Patriots were fined $1 million and lost two draft choices in the case.

The union praised the ruling, saying in a written statement by its executive director, DeMaurice Smith, that the “rights of Tom Brady and of all NFL players under the collective bargaining agreement were affirmed today by a Federal Judge in a court of the NFL’s choosing” and praising Berman’s decision as a “fair and just result.”

“This decision should prove, once and for all, that our Collective Bargaining Agreement does not grant this Commissioner the authority to be unfair, arbitrary and misleading,” Smith’s written statement said. “While the CBA grants the person who occupies the position of Commissioner the ability to judiciously and fairly exercise the designated power of that position, the union did not agree to attempts to unfairly, illegally exercise that power, contrary to what the NFL has repeatedly and wrongfully claimed.”

The case ended up in front of Berman after the NFL filed a lawsuit in New York seeking to have Goodell’s appeal decision affirmed. The NFLPA filed a lawsuit in Minneapolis. But the case ended up being heard in New York.

Berman wrote that because “there was no notice of a four-game suspension in the circumstances presented here, Commissioner Goodell may be said to have ‘dispense[d] his own brand of industrial justice.’”

Robert Kraft has been unwavering in his support of Brady throughout the DeflateGate saga and expressed his approval Thursday of Berman’s decision.

“As I have said during this process and throughout his Patriots career, Tom Brady is a classy person of the highest integrity,” Kraft said in a written statement. “He represents everything that is great about this game and this league. Yet, with absolutely no evidence of any actions of wrongdoing by Tom in the Wells report, the lawyers at the league still insisted on imposing and defending unwarranted and unprecedented discipline. Judge Richard Berman understood this and we are greatly appreciative of his thoughtful decision that was delivered today. Now, we can return our focus to the game on the field.”

The NFLPA called for the owners to allow neutral arbitration in all player disciplinary cases.

“We are happy for the victory of the rule of law for our players and our fans,” Smith said in the written statement. “This court’s decision to overturn the NFL Commissioner again should signal to every NFL owner that collective bargaining is better than legal losses. Collective bargaining is a much better process that will lead to far better results.”