referendum to overturn a California law that gives transgender students protections including the right to use the public school restrooms of their choice will not appear on the November ballot after its backers failed to gather enough voter signatures to qualify the measure, the secretary of state said Monday.

The law's opponents were led by a coalition of religious conservative groups who said it violates the privacy of youngsters who may be uncomfortable sharing facilities with classmates of the opposite biological sex. They needed at least 504,760 signatures to force a public vote on the statute approved by the California Legislature and signed by Gov. Jerry Brown last year. They submitted 619,381, but county election officers found just 487,484 of them to be valid.

If the referendum had made the ballot, the law would have been put on hold until after the election as its supporters and opponents mounted a campaign that promised to be as bitterly fought as the one over Proposition 8, the 2008 constitutional amendment that banned same-sex marriage in California until last year.

Kevin Snider, a lawyer with the Pacific Justice Institute who represents the Privacy for All Students coalition, said he and other conservative attorneys plan to challenge the secretary of state's determination by reviewing the invalidated signatures and going to court to try to get them added to the final tally.

"The secretary of state has had the inclination to disenfranchise voters, and we won't sit still and take their word for it," Snider said before the final count was announced.

The law that is the subject of the repeal attempt took effect Jan. 1. It guarantees students in grades K-12 the right to use the school facilities and to participate in the sex-segregated activities that correspond with their expressed genders instead of their school records.

Some school districts around California, as well as the education departments in Massachusetts and Connecticut, have implemented similar policies by regulation. But California is the first state to detail the rights of transgender students in schools by statute.

Although the law's opponents have focused on potential abuses and awkward encounters in bathrooms and locker rooms, schools also evaluated what it means for yearbook photo dress codes, sleeping arrangements for overnight field trips, and activities such as choirs and recreational sports where girls and boys are often separated.

The California Interscholastic Federation, which governs competitive high school sports, adopted a detailed process in 2012 that students must follow if they want to play on a team that is not consistent with their gender at birth.