In this Jan. 14, 2014, file photo, the general atmosphere is shown at a Photo Op with SAG/AFTRA Member Los Angeles Mayor Eric Garcetti in Hollywood, California.

A California law that sought to prevent age discrimination in the entertainment industry by blocking a popular Hollywood website from posting the ages of actors was struck down Tuesday as unconstitutional.

U.S. District Court Judge Vince Chhabria in San Francisco said the law passed in 2016 violated the First Amendment rights of IMDb.com by preventing it from publishing factual information on its website that provides information about movies, television shows and their casts and crews.

The law was a “direct restriction on speech” and was flawed because it was not narrowly tailored and was “underinclusive” by targeting IMDb, Chhabria said.

The ruling comes as sexual misconduct scandals that erupted in Hollywood last fall and spread more broadly have also brought new attention to pay disparity and other gender-related discrimination in the entertainment industry. Without referencing the #MeToo movement, the judge said the law was misguided because it sought to prevent discrimination of actors who couldn’t get parts because of age bias when a bigger problem was sex discrimination.

Materials supporting the law referred to the practice of casting younger women against much older men and also to the lack of women in leading roles and as directors, the judge said.

“This is not so much because the entertainment industry has a problem with older people per se,” Chhabria wrote. “Rather, it’s a manifestation of the industry’s insistence on objectifying women, overvaluing their looks while devaluing everything else.”

Supporters of AB 1687 said it was necessary because existing laws were not enough to eliminate age discrimination and older actors were concerned that they would be shut out roles. The law was defended by the state attorney general and Screen Actors Guild-American Federation of Television and Radio Artists.

SAG-AFTRA had argued it was OK to ban publishing the ages of actors and other entertainment professionals because those facts facilitated age discrimination. Chhabria noted that was “an argument that, if successful, would enable states to forbid publication of virtually any fact.”

The union said it was extremely disappointed with the ruling and would appeal.

“The court unfortunately fails to understand or recognize the massive impact gender and age discrimination has on all working performers,” said Duncan Crabtree-Ireland, general counsel of SAG-AFTRA. “That discrimination is facilitated by IMDb’s insistence on publishing performers’ age information without their consent.”

When the ‘Shib Sibs’ Saw Leslie Jones in the Crowd, They Knew It Would Be a Good Day

Chhabria had temporarily halted the law from taking effect last year while he heard further arguments in the case.

IMDb, also known as the Internet Movie Database, had argued it shared the goal of preventing age discrimination, but the law would fail to achieve that and instead would “chill free speech and undermine public access to factual information.”

Representatives of the lawmaker who authored the bill, the attorney general who defended it or the entertainment website that challenged the law did not immediately provide comment requested by The Associated Press.

Follow NBC4

Copyright Associated Press

A lesbian couple has sued the Trump administration over a denial of their application to serve as foster parents for refugee children.

The lawsuit, filed by the LGBTQ legal group Lambda Legal, says that married couple Fatma Marouf and Bryn Esplin tried to become foster parents for refugee children. It was filed against the Department of Health and Human Services and the U.S. Conference of Catholic Bishops.

The couple, who both teach at Texas A&M University, applied to their local U.S. Conference of Catholic Bishops to become foster parents. However, their application was denied after they revealed they were a same-sex couple who did not “mirror the Holy Family,” Lambda Legal said.

“Being denied the opportunity to foster a child because we don’t ‘mirror the Holy Family’ — clearly code for being a same-sex couple — was hurtful and insulting to us,” Esplin said. “More than that, though, insisting on such a narrow, religious view of what a family must look like deprives these children of a nurturing, supportive home.”

HHS gives the conference, which is made up of all active and retired Catholic U.S. bishops, grants for the foster care program through the agency’s Office of Refugee Resettlement.

The couple reached out to HHS after the group denied their application. While the agency responded asking for the names of the people the couple met, they said they have not heard anything else.

The lawsuit filed in the U.S. District Court for the District of Columbia charges that HHS and the conference are violating equal protection clauses under the Constitution by allowing the conference to impose a “religious test governing the provision of federal child welfare services.”

HHS said it had no comment on the lawsuit, and the USCCB did not immediately return requests for comment on the lawsuit.