A federal appeals court on Wednesday will start hearing arguments in a transgender student’s lawsuit against a Virginia school district that had barred him from using the boys’ bathroom.

The case could have national implications by determining how public schools address sex discrimination in the wake of so-called “bathroom bully bills” that ban trans students from using the restrooms that match their gender identities.

Gavin Grimm, a trans male student at Gloucester County High School in Virginia, sued the Gloucester School District in June 2015 for sex discrimination based on the school’s bathroom policy, which had forced him to use a restroom that is separate from the other students.

But last September, a federal judge for the Eastern District of Virginia rejected Grimm’s request for the district to halt its policy. The American Civil Liberties Union, which is representing Grimm, appealed the ruling to the Fourth Circuit Court of Appeals, which will decide whether banning Grimm from the boys’ bathroom is a violation of federal law.

In the appeal, the ACLU argues that the Gloucester School District is violating Title IX, a federal education law banning sex discrimination in publicly funded schools. “Excluding [Grimm] from the same restrooms used by all other students further denies [Grimm] equal educational opportunity by publicly shaming him and physically isolating him from the rest of his peers,” the ACLU said.

Grimm was designated female at birth, but he had always felt uncomfortable wearing girls’ clothes, and eventually refused to wear them. At the age of 12, he came out to his family and friends about his transgender male identity and soon began living as a boy under the advisement of a psychologist, according to court documents.

Grimm’s high school was supportive when, before the beginning of his sophomore year of high school, he and his mother disclosed that he was transgender and would be presenting as male. Grimm used the boys’ bathroom at school without any trouble. However, after a few weeks, according to court documents, parents began complaining to the school board, culminating in a confrontational school board meeting in November 2014. Parents referred to Grimm as “young lady” and “freak” and raised concerns that allowing him to use the boys’ bathroom could lead to sexual assaults, similar to the arguments raised by opponents to Houston’s Equal Rights Ordinance.

The board approved a new policy that sex-segregated bathrooms could only be used by students of “the corresponding biological genders,” and that students such as Grimm who had “gender identity issues” could use a separate facility.

Since then, Grimm has taken to holding his urine for as long as he can during the school day, which has resulted in multiple urinary tract infections, according to court documents.

“I feel humiliated and dysphoric every time I’m forced to use a separate facility,” Grimm told reporters in a conference call.

The Gloucester School District has argued that it did its best to make accommodations for Grimm, and that “separating students by sex based on biological and anatomical characteristics for restroom and locker room use does not violate the Equal Protection Clause or Title IX.”

The federal government, for its part, has filed a statement of interest in support (PDF) of Grimm’s case, writing that “there is a public interest in ensuring that all students, including transgender students, have the opportunity to learn in an environment free of sex discrimination.”

Several advocacy groups have also filed briefs in support of Grimm and the ACLU, including the National Women’s Law Center, the World Professional Association for Transgender Health and the Transgender Law and Policy Institute.

“The [district] court’s decision to prohibit Gavin from using the boys’ restroom is out of step with model school district policies which state that students should have access to facilities that correspond to their gender identity,” Michael Silverman, executive director of the Transgender Legal Defense and Education Fund, said in a statement. “It is a threat to Gavin’s health and well-being, and we hope it is swiftly overturned on appeal.”

Lawmakers in Nevada, Minnesota, Florida and Texas introduced bills in 2015 that would ban transgender children from using the bathrooms that match their gender identities, but none of them have been passed into law.

Two previous lawsuits filed by transgender students against their schools have upheld access to bathrooms corresponding to their gender identities. In 2013, the family of Coy Mathis, a transgender first grader, won a lawsuit against their Colorado school district that resulted in her being allowed her to use the girls’ bathroom. And in 2014, Maine's highest court ruled in favor of transgender student Nicole Maines after she sued when her high school required her to use a separate restroom for staff.