California Governor Jerry Brown on Monday signed a first-in-the-nation bill that gives transgender K-12 students certain rights.

The new law requires public schools to allow transgender students access to the restroom and locker room of their choice. Those students can also decide what sports they want to play.

Supporters said the law will help reduce discrimination faced by transgender students.

“We are grateful to Governor Brown for his longstanding commitment to ensuring that all California students are able to attend school without discrimination or harassment,” Shannon Minter, legal director of the National Center for Lesbian Rights (NCLR), said in a statement.

Masen Davis, executive director of the Transgender Law Center, said the law would give transgender students “the same fair chance at success as their classmates.”

Opponents of the measure had urged Governor Brown to veto the measure, which they dubbed the “bathroom bill.”

“What about the right to privacy of a junior high school girl wanting to go to the bathroom and having some privacy, or after PE showering and having to worry about being in the locker room with a boy?” Karen England, executive director of Capitol Resource Institute, is quoted as saying by the AP.

(Related: Transgender girl Coy Mathis triumphs in bias complaint.)