Maine's highest court sided with a transgender girl Thursday in a ruling that stated her school violated state law when it denied her access to the girls' restroom.

The 5-1 decision by the Maine Supreme Judicial Court reversed a lower court's ruling from November 2012 and stated that the school was in violation of Maine's Human Rights Act when it denied Nicole Maines (referred to in the ruling as Susan Doe) access to the appropriate bathroom when she was a fifth-grade student at Asa Adams Elementary School in 2007.

According to the ruling, "it has been clearly established that a student's psychological well-being and educational success depend upon being permitted to use the communal bathroom consistent with her gender identity, denying access to the appropriate bathroom constitutes sexual orientation discrimination in violation of the [Maine Human Rights Act]."

While Maines was originally granted access to the girls' bathroom, the school later barred Maines from doing so following media attention when a male student followed her into the girls' bathroom at the instruction of his grandfather, who was opposed to the policy.

"Based upon its determination that Susan is a girl, and in keeping with the information provided to the school by Susan's family, her therapists, and experts in the field of transgender children, the school determined that Susan should use the girls' bathroom. In so doing, the school provided her with the same access to public facilities that it provided other girls," the ruling states.

"[The school's] later decision to ban Susan from the girls' bathroom, based not on a determination that there had been some change in Susan's status but on others' complaints about the school's well-considered decision, constituted discrimination based on Susan's sexual orientation," the ruling continues. "She was treated differently from other students solely because of her status as a transgender girl."

The ruling from Maine's highest court in Doe v. Clenchy marks the first time a state court has ruled that transgender students must be allowed to use the bathrooms for the gender they identity with.

Calling the ruling a "momentous decision," Jennifer Levi, director of GLAD's Transgender Rights Project, who argued the case before the Maine Law Court in June, said the decision "marks a huge breakthrough for transgender young people."

"Schools have a responsibility to create a learning environment that meets and balances the needs of all kids and allows every student to succeed," Levi said in a statement. "For transgender students this includes access to all school facilities, programs, and extracurricular activities in a way that is consistent with their gender identity."

Added co-counsel in the case and GLAD Senior Attorney Bennett Klein, "A transgender girl is a girl and must be treated as such in all respects, including using the girls' restroom. This ruling is consistent with what educators and human rights commissions - including the Maine Human Rights Commission - around the country have concluded."

A Utah lawmaker has proposed a bill that would prevent transgender students from using bathroom facilities of their choice, joining a debate playing out in a handful of other states sparked by a California law that broke new ground on transgender rights.