A federal appeals court in Richmond has ruled that a transgender high school student who was born as a female can sue his school board on discrimination grounds because it banned him from the boys' bathroom.

In backing high school junior Gavin Grimm, the U.S. Court of Appeals for the 4th Circuit deferred to the U.S. Education Department's position that transgender students should have access to the bathrooms that match their gender identities rather than being forced to use bathrooms that match their biological sex.

The department has said that requiring transgender students to use a bathroom that corresponds with their biological sex amounts to a violation of Title IX, which prohibits sex discrimination at schools that receive federal funding.sex discrimination at schools that receive federal funding.

"It's a complete vindication for the Education Department's interpretation of Title IX," said Joshua Block, an American Civil Liberties Union lawyer who represents Grimm.

In a 2-to-1 decision, the 4th Circuit ordered a lower court to rehear the student's claims that the Gloucester County, Virginia, school board's bathroom policies - which restrict transgender students to using a separate unisex bathroom - violate federal law.

The judges also ruled that the lower court should reconsider a request that would have allowed Grimm to use the boys' bathroom at Gloucester High School while the case is pending.

The 4th Circuit is the highest court to weigh in on the question of whether bathroom restrictions constitute sex discrimination, and the decision could have widespread implications on how U.S. courts interpret the issue as civil rights activists and local politicians battle over bathrooms.

The question of which bathrooms transgender people can use has become a divisive political issue in several states, emerging as an emotional fight in South Dakota, Texas, Illinois, Mississippi and Virginia. In North Carolina, a law banning local protections for gay and transgender people - a measure centering on bathrooms - has sparked protests, boycotts and calls for an immediate repeal.

Public bathrooms have become the latest battleground in the fight for LGBT rights, with conservative activists and some state lawmakers pushing restrictions that prevent transgender people from using bathrooms in accordance with their gender identity. Activists have used the bathroom debate as a venue for rolling back broader civil rights protections, arguing that allowing transgender people into the supposedly safe spaces of single-sex bathrooms creates dangerous scenarios and violates privacy and common sense.

The 4th Circuit judges wrote that interpretations of federal discrimination policies should be left to politicians, in this case the Obama administration's Education Department.

The court ruled that Grimm has an argument that his school board violated his rights based on those interpretations, but the court did not decide whether transgender students faced discrimination in Gloucester, leaving that question to the lower court.

"At the heart of this appeal is whether Title IX requires schools to provide transgender students access to restrooms congruent with their gender identity," the court's opinion said. "We conclude that the Department's interpretation of its own regulation . . . as it relates to restroom access by transgender individuals, is . . . to be accorded controlling weight in this case."

LGBT advocates celebrated Tuesday's court decision and were hopeful that it would help turn back the tide of efforts by state lawmakers to get bathroom restrictions on the books.

The Human Rights Campaign, which tracks bills related to lesbian, gay, bisexual and transgender issues, counted 14 states that debated bills that would restrict bathroom usage for transgender students.

"I think this is going to be a wake-up call for legislators," said Peter Renn, an attorney for an LGBT advocacy group. He said he believes that lawmakers contemplating bathroom restrictions for transgender people are "essentially on a collision course with federal law and federal courts."

Lawyer Mat Staver of Liberty Counsel, which has backed efforts to roll back LGBT protections for students, took a more cautious view, noting that the judges opted to send the case back down to the district court. "I don't think this case has any definitive answer, and it's not a definitive ruling on what Title IX says," Staver said.

The issue has been at the center of state-level debates in recent months, most notably in North Carolina, where Gov. Pat McCrory (R) recently signed into law a ban on local government measures that protect gay and transgender people from discrimination; he focused specifically on the bathroom issue in arguing that the ban was necessary to prevent local governments from allowing "a man to use a woman's bathroom, shower or locker room." A transgender university student and employee already have sued to overturn the new law and the 4th Circuit's ruling could bolster their argument that bathroom restrictions are discriminatory, Renn said.

The North Carolina law has sparked protests and economic boycotts in the state. Duke University leaders this week publicly condemned "in the strongest possible terms" the North Carolina law and called for its repeal.

McCrory said in a video statement posted online Tuesday that he disagreed with the 4th Circuit's ruling, calling it a "bad precedent."

South Dakota Gov. Dennis Daugaard (R) vetoed a bill that would restrict transgender public school students from using bathrooms in accordance with their gender identity, arguing that schools were best equipped to handle accommodations for transgender students.

Voters in Houston last year voted down a law that would have extended nondiscrimination protections to gay and transgender people, and a new law in Mississippi allows schools to require students to dress and use the bathroom in accordance with the gender on their birth certificate.

The case in Virginia centers on Grimm, now a junior at Gloucester High School. Grimm, who was born with female anatomy, came out as male to his classmates in high school and began using the boys' bathroom his sophomore year. Seven weeks later, angry parents raised concerns with the school board, prompting members to pass a policy that requires students to use school bathrooms corresponding with their "biological gender" and indicates that transgender students should use a separate, unisex bathroom.

Grimm sued the school board in federal court, arguing that the new rule violated Title IX, the federal law that bars gender discriminationin the nation's schools. He also asked for a preliminary injunction to allow him to use the boys' bathroom while his case proceeded.

Troy M. Andersen, chair of the Gloucester County School Board, and David Corrigan, the attorney representing the school board, did not responded to requests for comment Tuesday.

Transgender students say that using the bathroom that corresponds with their gender identity is important for them - and others - to feel comfortable. A transgender boy who appears male may generally raise alarms if he is forced to use the girls' bathroom.

Grimm has said that the debate made him the subject of ridicule within his community.

"Matters like identity and self-consciousness are something that most kids grapple with in this age range," Grimm said in January. "When you're a transgender teenager, these things are often very potent. I feel humiliated and dysphoric every time I'm forced to use a separate facility."

In a dissent, Judge Paul V. Niemeyer of the 4th Circuit said the ruling "completely tramples on all universally accepted protections of privacy and safety that are based on the anatomical differences between the sexes."

"This unprecedented holding overrules custom, culture, and the very demands inherent in human nature for privacy and safety, which the separation of such facilities is designed to protect," Niemeyer wrote.