Utah became the latest state to regulate bathroom access for transgender people after Republican Gov. Spencer Cox signed a law Tuesday that requires people to use bathrooms and locker rooms in public schools and government-owned buildings that match their sex assigned at birth.

Under the legislation, transgender people can defend themselves against complaints by proving they had gender-affirming surgery and changed the sex on their birth certificate. Opponents noted not all states allow people to change their birth certificates and that many trans people don’t want to have surgery.

The legislation also requires schools to create “privacy plans” for trans students and others who may not be comfortable using group bathrooms, for instance by allowing them to use a faculty bathroom — something opponents say may “out” transgender children.