Children in California public schools must be accommodated based on their self-perceived gender identity — which means biological girls may use boys’ bathrooms and biological boys may join the girls’ cheerleading squads — under a law signed Monday by California Gov. Jerry Brown.

The law goes into effect Jan. 1 and is expected to affect some 6.2 million public school students in kindergarten to 12th grade.

“We are grateful to Gov. Brown for his long-standing commitment to ensuring that all California students are able to attend school without discrimination or harassment. By signing AB 1266, he has made that commitment real for transgender students, who will now have the same opportunities to participate and to succeed as other students,” said Shannon Minter, legal director of the National Center for Lesbian Rights (NCLR) and a female-to-male transgendered man.

Mr. Brown has “sent a powerful message” to youths “letting them know their state and their government fully support them,” Equality California, Transgender Law Center, the American Civil Liberties of California and the NCLR said in a joint statement.

California laws already prohibit discrimination against transgendered people in areas such as education, and several California school districts were honoring the wishes of transgendered students.

But the School Success and Opportunity Act was needed to ensure that all public school officials cooperate with transgender children in their choices of bathrooms and sex-specific activities, its author said.

Many school districts were not treating transgender students “the same as all other students in the specific areas addressed by this bill,” California Assemblyman Tom Ammiano, a Democrat, said when he introduced AB 1266 with support from the Transgender Law Center and other gay-rights groups.

Under the law, public school students from kindergarten to 12th grade must be “permitted to participate in sex-segregated school programs and activities, including athletic teams and competitions, and use facilities consistent with his or her gender identity, irrespective of the gender listed on the pupil’s records.”