A Colorado primary school discriminated against a six-year-old transgender girl by barring her from using the girls' toilets, a civil rights panel has said.
The panel in the US state of Colorado said Coy Mathis' school ignored her gender identity and created an environment "rife with harassment".
Her family had removed her from the school in response.
The case comes as schools and governments across the US grapple with the emergence of transgender people.
It is seen as a test of Colorado's expanded civil rights protections, passed in 2008.
Coy had been allowed to use the girls' toilets without issue until several months into her second year at Eagleside Elementary School, according to the ruling.
In December 2012, school officials said Coy must use the boys' toilets or single-stall rooms in the teachers' lounge or the nurse's office.
Under the decision by the civil rights division of the Colorado Department of Regulatory Agencies, the school district and Coy's family must "attempt amicable resolution" in accordance with the discrimination finding.
The Transgender Legal Defense and Education Fund, which assisted the family's case, hailed the decision.
"This ruling sends a loud and clear message that transgender students may not be targeted for discrimination and that they must be treated equally in school," Executive Director Michael Silverman said in a statement.
Coy's mother, Kathryn Mathis, said the family was "thrilled that Coy can return to school and put this behind her".
"All we ever wanted was for Coy's school to treat her the same as other little girls."
The school district, Fountain-Fort Carson, has declined to discuss the case.
But a spokeswoman for the Colorado Department of Regulatory Agencies said the district could seek arbitration or a public trial.
While she had always expressed a preference for things associated with girls, Coy became depressed and withdrawn if forced to wear boys' clothes or referred to as a boy in school, her family said.
The Mathises said the school had initially been "really fantastic" in response to their requests that Coy be treated as a girl in school and that their daughter had "blossomed" as a result.