Updated

A federal judge in Virginia ruled Friday in favor of a transgender former student, concluding that a school board's transgender restroom ban was discriminatory.

"There is no question that the board's policy discriminates against transgender students on the basis of their gender nonconformity," U.S. District Judge Arenda Wright Allen in Norfolk wrote in her decision, putting an end to a four-year lawsuit brought against Gloucester High School by former student Gavin Grimm.

CIVIL RIGHTS PROBE OPENED INTO TRANSGENDER ATHLETE POLICY

"Under the policy, all students except for transgender students may use restrooms corresponding with their gender identity," she continued. "Transgender students are singled out, subjected to discriminatory treatment and excluded from spaces where similarly situated students are permitted to go."

Grimm, a transgender male, was forced to use the girl's restroom or a private restroom and was prohibited from using the men's room as a result of the school's policy, despite the fact that he underwent chest reconstruction surgery and hormone therapy as part of his transition.

In this July photo, Gavin Grimm, who has become a national face for transgender students, speaks during a news conference held by the ACLU and the ACLU of Virginia at Slover Library in Norfolk, Va.  (Associated Press)

In this July photo, Gavin Grimm, who has become a national face for transgender students, speaks during a news conference held by the ACLU and the ACLU of Virginia at Slover Library in Norfolk, Va.  (Associated Press)

Gender is not a "societal construct," David Corrigan, the attorney for the Gloucester County School Board, argued unsuccessfully in court.

Allen ruled that Grimm's rights were violated under the Constitution's equal protection clause as well as under Title IX, the federal policy that protects against gender-based discrimination and requires the school board to update Grimm's gender on his high school transcripts. (He graduated in 2017.)

Judge Allen acknowledged that the school board had the "unenviable responsibility" of creating fair and inclusive rules for students on an issue that didn't exist until recently.

"There can be no doubt that all involved in this case have the best interests of the students at heart," Allen said.

Grimm tweeted after the ruling, "It is such a relief to achieve this closure and vindication from the court after four years of fighting not just for myself, but for trans youth across America."

Grimm's lawsuit was backed by President Barack Obama's administration and was scheduled to go before the U.S. Supreme Court in 2017, but the hearing was canceled after President Trump rescinded an Obama-era directive that students can choose the restroom they deem fit according to their gender identity.

Grimm, now 20 and living in California, told The Associated Press the court's decision was "beautiful."

"My case has given me something of a platform that I intend to use, as long as I have it available to me, for trans education and advocacy," he added.

CLICK HERE FOR THE FOX NEWS APP

Grimm's lawsuit has been used as a federal test about discriminatory policies against transgender students and may set a precedent for similar cases in the future.

The American Civil Liberties Union celebrated Grimm's victory, saying: "A federal court just agreed with us that Gloucester High School was wrong to deny Gavin Grimm access to the boys’ restrooms and an accurate transcript identifying him as a boy. Trans people belong in schools. Trans people belong EVERYWHERE."

The Associated Press contributed to this report.