A transgender fifth-grader should have been allowed to use the bathroom of her choice, Maine's highest court ruled Thursday, concluding that school officials violated state anti-discrimination law.

Nicole Maines' family and the Maine Human Rights Commission sued in 2009 after school required her to use a staff bathroom instead of the girls' restroom. A state Superior Court judge ruled that the Orono school district acted within its discretion, and a lawyer for the district said that it should be up to the Maine Legislature to clarify the issue.

The Maine Supreme Judicial Court concluded Thursday that the school district's actions violated the Maine Human Rights Act, a state law that bans discrimination based on sexual orientation.

"This is a momentous decision that marks a huge breakthrough for transgender young people," said Jennifer Levi, director of Transgender Rights Project for Gay & Lesbian Advocates & Defenders, who argued the case on the family's behalf.

School administrators across the country are grappling with the issue.

Colorado officials said last year that a suburban Colorado Springs school district discriminated against a 6-year-old transgender girl by preventing her from using the girls' bathroom.

In California, there's an effort afoot to try to repeal a law that allows public school students to use bathrooms and locker rooms that correspond with their expressed genders.

In the Maine case, Nicole Maines was using the girls' bathroom in her elementary school until the grandfather of a fifth-grade boy complained to administrators. The Orono school district determined that Maines should use a staff bathroom, but her parents contended that amounted to discrimination.

Maines is a biological male who identified as a girl beginning at age 2.

Now a teenager, Maines said after arguments before the high court last summer that she hoped the justices understood the importance of going to school, getting an education and making friends without having to be "bullied" by other students - or school administrators.

Her father said he was grateful that the court agreed that his daughter shouldn't be singled out.

"As parents all we've ever wanted is for Nicole and her brother, Jonas, to get a good education and to be treated just like their classmates, and that didn't happen for Nicole," Wayne Maines said in a statement. "What happened to my daughter was extremely painful for her and our whole family, but we can now close this very difficult chapter in our lives."

Melissa Hewey, lawyer for the school district, said the 5-to-1 ruling provided clarity not just to Orono schools, but to schools around the state.

"The court has now clarified what has been a difficult issue and is a more and more common in schools, and the Orono School Department is going to do what it needs to do to comply with the law," she said.

The Supreme Judicial Court pointed out that its ruling was based on the circumstances of the case in which there was ample documentation of the student's gender identity.

"Our opinion must not be read to require schools to permit students casual access to any bathroom of their choice," Justice Warren Silver wrote.