A federal judge in Virginia has found in favor of a transgender student whose efforts to use the boys’ bathrooms at his high school reached the Supreme Court and thrust him into the middle of a national debate about the rights of transgender students.

In an order handed down on Tuesday, Judge Arenda L. Wright Allen of the United States District Court for the Eastern District of Virginia denied a motion by the Gloucester County school board to dismiss the lawsuit brought by the student, Gavin Grimm.

The school board had maintained that Mr. Grimm’s “biological gender” was female and had prohibited administrators from allowing him to use the boys’ restrooms. He sued the school board in July 2015, alleging that its policy violated Title IX as well as the equal protection clause of the Constitution.

The board had argued in essence that its policy was valid because Title IX allows for claims only on the basis of sex, rather than gender identity, and that its policy did not violate the equal protection clause.