A federal court judge has barred California’s legislation requiring that subscription entertainment database sites remove an actor’s age, if requested by the actor.

U.S. District Court Judge Vince Chhabria issued the ruling on Tuesday. IMDb filed a lawsuit in November of 2016, attempting to invalidate AB 1687. IMDb — a subsidiary of Amazon — had contended in its suit that the law, which applies only to subscription sites such as IMDb Pro, was unconstitutional.

The defendants are Secretary of State Xavier Becerra and SAG-AFTRA, which joined the suit as a defendant after campaigning vigorously for the law in 2016.

“Because the defendants have not shown that AB 1687 can withstand strict scrutiny, and because they have raised no dispute of material fact that would entitle them to a trial, IMDb’s motion for summary judgment is granted, and the defendants’ motion for summary judgment is denied,” the judge wrote in the new ruling. “The State of California is permanently enjoined from enforcing AB 1687.”

Chhabria had granted a preliminary injunction a year ago and said at the time that it was “difficult to imagine how AB 1687 could not violate the First Amendment.” He was more explicit in the ruling on Tuesday.

“Applying the proper level of scrutiny, AB 1687 is clearly unconstitutional,” Chhabria said. “The law on its face singles out specific, non-commercial content — age-related information — for differential treatment.”

Legislators were lobbied in 2016 by SAG-AFTRA on the issue, with the performers union contending that the restriction would help combat age discrimination against actors.

SAG-AFTRA president Gabrielle Carteris has insisted that she might not have been cast in “Beverly Hills 90210” as high school valedictorian and newspaper editor Andrea Zuckerman had her actual age been known at the time. “Beverly Hills 90210” aired from 1990 to 2000.

SAG-AFTRA said it will appeal the ruling to the Ninth Circuit Court of Appeals. Duncan Crabtree-Ireland, chief operating officer and general counsel, issued a statement.

“SAG-AFTRA is extremely disappointed with today’s ruling in IMDb v. Becerra and SAG-AFTRA,” Crabtree-Ireland said. “The Court unfortunately fails to understand or recognize the massive impact gender and age discrimination has on all working performers. That discrimination is facilitated by IMDb’s insistence on publishing performers’ age information without their consent. The ruling also refuses to recognize the reality of the commercial nature of IMDb’s database publishing operation. Despite sworn testimony submitted by SAG-AFTRA, the Court incorrectly concluded there were no material disputed factual issues, while precluding the parties from acquiring additional evidence or permitting the case to go to trial. SAG-AFTRA will continue to defend this much-needed law by appealing this ruling to the Ninth Circuit Court of Appeals.”