(CNN) Transgender and gender-nonbinary US teens -- those whose sexual identity falls outside the traditional male and female -- are at greater risk of sexual assault at schools that deny them access to bathrooms or locker rooms that match their sexual identity, according to a new study.

Researchers analyzed data from 3,673 adolescents in the LGBTQ Teen Study, an anonymous web-based survey of US kids ages 13 to 17. Students who reported being told by teachers or staff that they could not use restrooms or locker rooms consistent with their sexual identity at school were classified as having "restrictive access."

Just over 1 out of every 4 students in the study, or 25.9%, reported being a victim of sexual assault in the past 12 months. Transgender and gender-nonbinary teens who were subject to restroom or locker room restrictions had an even higher prevalence of sexual assault, at 36%, according to the findings, published Monday in the journal Pediatrics.

The rates of sexual assault for nontrans US teens, those whose gender identity matches their sex assigned at birth, is 15% for girls and 4% for boys, according to the Youth Risk Behavior Surveillance Survey administered by the US Centers for Disease Control and Prevention.

"Unfortunately, kids' access to restrooms and locker rooms has become very politicized in some communities," said Gabriel Murchison, a doctoral candidate at the Harvard T.H. Chan School of Public Health and lead author of the study.

Research has shown that restrictive policies draw unwanted negative attention to trans and gender-nonbinary teens, but until this study, it wasn't clear whether there was a connection to sexual violence, Murchison said.

He explained that the study can only establish an association, not whether the restrictions themselves caused the sexual assault. "But they are certainly a strong indicator of environments where kids are at risk," he added.

The bathroom debate came to the national consciousness with a few recent cases.

High-profile cases spark debate

In 2018, a federal court ruled against a Virginia school district that prohibited Gavin Grimm, a transgender male student, from using the boys' bathroom at school. The ruling came four years after Grimm's initial complaint.

Later that year, federal courts ruled in favor of a trans student in Florida and another in Pennsylvania who were prohibited by school staff from using restrooms consistent with their sexual identities.

In 2016, North Carolina lawmakers passed HB2, which banned people from using public bathrooms that didn't correspond to their biological sex, as listed on their birth certificates. It became the first state to pass what came to be known as a "bathroom bill." Backlash caused huge economic losses for the state, such as businesses canceling expansion plans and the NBA moving its all-star game from Charlotte. The law was repealed in 2017.

Also that year, 19 other states considered "bathroom bill" legislation aimed at restricting access to multiuser bathrooms, locker rooms and other sex-segregated facilities based on the definition of gender as sex assigned at birth, according to the National Conference of State Legislatures . In over half of the states, the legislation was aimed specifically at facilities in schools.

South Dakota passed legislation in 2016 that was later vetoed by the governor.

California, on the other hand, enacted Assembly Bill 1266 in 2013, becoming the first and only state at the moment to give students in kindergarten through 12th- grade public schools the right to use bathrooms and locker rooms consistent with their affirmed gender identity, according to an editorial published alongside the new study.

Restrictive policies are often based on fear

Policies that restrict bathroom and locker room access are often fear-based, explained Diane Ehrensaft, a clinical psychologist and founding member of the UCSF Child and Adolescent Gender Center, and Dr. Stephen Rosenthal, medical director of the clinic, in the editorial.

Non-transgender students are mistakenly thought to be the ones at risk of sexual assault by "transgender intruders" or by predators posing as transgender students, they wrote. "Sometimes it is the school personnel who hold this attitude. Sometimes it is anxious and angry parents who do not want their children exposed to or 'damaged by' the gender-minority youth at their school."

The new study, Ehrensaft and Rosenthal explain, demonstrates that sexual harm is done to -- rather than by -- trans and gender-nonbinary students.

Limiting bathroom access harms students in several ways

There are several reasons why not allowing students to use bathrooms consistent with their gender identity may place them at higher risk of sexual assault. Bathroom restrictions may make peers aware of the teens' status as a gender minority, the authors explain, which may in turn make them more likely to become victims of abuse.

The policies may also be indicators of a hostile school environment.

"Not surprisingly, some will avoid using restrooms altogether," Ehrensaft and Rosenthal explained in the editorial. This means teens may not drink enough fluids and may ignore the need to use the restroom, resulting in urinary tract infections, impacted bowels and avoidance of school altogether, they added.

For schools looking to improve safety, Murchison points to students as the best source of guidance.

"At some schools, bathrooms and locker rooms may be the biggest issue, but at other schools it may be something different," he said. "Students may also be able to identify 'hot spots' for harassment and violence within the school building that need to be more closely supervised."

Get CNN Health's weekly newsletter Sign up here to get The Results Are In with Dr. Sanjay Gupta every Tuesday from the CNN Health team.

Some schools have designated all-gender restrooms that can be used by any student. Although this can be useful, Murchison warns that it should not be the only option available for trans and gender-nonbinary students.