SAN FRANCISCO (CN) – A federal judge on Wednesday blocked California from enforcing a law that restricts the publication of actors’ ages, finding the law blatantly unconstitutional.

“It’s difficult to imagine how AB 1687 could not violate the First Amendment,” Chhabria wrote in his three-page ruling.

The judge granted the Internet Movie Database’s motion for a preliminary injunction against the law, finding the state failed to show how making IMDb take down actors’ ages advanced its intended goal of curbing age discrimination in Hollywood.

“It’s not clear how preventing one mere website from publishing age information could meaningfully combat discrimination at all,” Chhabria wrote. “And even if restricting publication on this one website could confer some marginal antidiscrimination benefit, there are likely more direct, more effective, and less speech-restrictive ways of achieving the same end.”

IMDb sued the state in November last year, claiming lawmakers bowed to Hollywood special interests when they passed AB 1687, which was backed by the Screen Actors Guild and signed into law on Sept. 24, 2016.

The law requires “commercial online entertainment employment service providers,” of which IMDb is the only known such entity, to take down actors’ ages and birth dates from its websites upon request.

During a hearing last week, Chhabria warned the state that continuing to defend the law would likely result in more taxpayer dollars going to IMDb lawyers in the form of attorneys’ fees awards once the lawsuit ends.

Nevertheless, an attorney for the intervening defendant Screen Actors Guild said the actors’ union would likely pursue limited discovery on how IMDb obtains age information and how that information is used by casting directors.

In an emailed statement, the guild’s chief operating officer and general counsel Duncan Crabtree-Ireland called the injunction “an early skirmish” in a “long-term battle” to secure employment protections for workers in the entertainment industry.

“We are disappointed that the court has chosen to temporarily halt the State of California’s legal efforts to fully protect its citizens from employment discrimination,” Crabtree-Ireland said. “We look forward to the upcoming opportunity to present evidence to the Court of how this law will reduce or eliminate the age discrimination facilitated by IMDb.com.”

IMDb was created in 1990 by the company’s CEO Collin Needham, and its website was launched in 1996. The online database of on-screen entertainment has grown to feature 3 million movies and TV programs along with 6 million cast and crew members. It boasts 250 million unique visitors each month, according to IMDb’s lawsuit.

A spokesperson for California Attorney General Xavier Becerra’s office said in an email that Becerra’s office was reviewing the ruling and had no immediate comment.

IMDb did not respond to an email seeking comment Wednesday, and the movie industry website’s attorney, Adam Olin, and his law firm’s spokesperson declined to comment.

Olin is with Hueston Hennigan in Los Angeles.