A federal court ordered a Virginia school district on Thursday to let a transgender student use the same bathrooms as other boys in a case that may be headed to the U.S. Supreme Court.

The case of Gavin Grimm, a high school student in Virginia's Gloucester County, has been closely watched in the national bathroom wars between transgender rights activists and social conservatives.

A U.S. district court in Norfolk, Virginia, ordered the Gloucester County School Board to allow Grimm to use the boys' restrooms in his high school.

The court had initially dismissed Grimm's claim of sexual discrimination and request for a court order. But a three-judge panel of the U.S. Fourth Circuit Court of Appeals found in Grimm's favor in April and reinstated his suit in the lower court.

"I am elated to hear that I'll be able to attend my senior year of high school with my full rights restored,” Grimm said in a statement.

The ruling was the first by an appeals court finding protections for transgender students under the 1972 Title IX Act, which bars sex-based discrimination by schools receiving federal funding.

Grimm filed suit after being barred from using the boys’ bathrooms. He was born a female but identifies as a male.

The school board said this month that it would ask the Supreme Court to review the appeals court ruling.