"Harmful, intrusive and humiliating," one advocate warned.

The ruling will impact laws in more than 25 states.

The Supreme Court is upholding state laws barring transgender girls and women from playing on school athletic teams, in another setback for transgender people.