The Virginia Supreme Court on Thursday dismissed a lawsuit brought by a Fairfax County student who challenged the school board’s move to add gender identity and sexual orientation to its anti-harassment policy, saying the new policies left him traumatized and in distress.

The unnamed student, his parents and conservative activist Andrea Lafferty sued in 2015, saying that the move to expand anti-discrimination policies to include gay and transgender students and staffers ran afoul of state law.

In the lawsuit, the high school student, called “Jack Doe,” described being “terrified of the thought of having to share intimate spaces with students who have the physical features of a girl, seeing such conduct as an invasion of privacy.” The suit said the student is also “distressed” because the school board has not defined “gender identity” or “gender expression,” and worries that he could be disciplined for “unknowingly violating the ambiguous code of conduct.”

“He understands that the decision will mean that the restrooms, locker rooms and other intimate spaces . . . will now be open to students who might have the physical features of one sex but are permitted to use the bathroom of the opposite sex which the student ‘identifies’ as, whatever that means,” attorneys wrote in the lawsuit.

The school system’s policies say nothing about bathrooms and locker rooms, although officials allow transgender students to use bathrooms and locker rooms according to the gender with which they identify.

When the school board voted to change its policy, members said it was done to clarify the district’s stance on how to accommodate transgender students and to help them feel safe.

Sandy Evans, chair of the school board, said she is pleased that the court’s decision will allow the policy to stand.

“Fairfax County Public Schools will continue creating an educational environment where everyone is treated with respect,” Evans said. “We will also continue to accommodate the needs of transgender and gender nonconforming students in a way that protects the dignity and privacy of all students.”

The school board voted to change its nondiscrimination policy to include gay students and staffers in December 2014. Six months later, the board expanded the policy to bar discrimination on the basis of “gender identity” despite vocal opposition from Lafferty and some parents in the district.

Lafferty, the boy and the boy’s parents sued in December 2015, and a lower court dismissed the suit three months later, saying that none of those who filed the suit had standing. They appealed the case to the Virginia Supreme Court, which heard oral arguments in March.

The high court affirmed the lower court’s ruling Thursday and said that the boy’s claims that the new policy was doing him harm were not sufficient grounds to sue, because the harm was only theoretical.

“The complaint alleges only that Jack Doe fears that the policy might involve the use of his bathroom or locker room by a transgender student. Jack’s sharing of a bathroom or locker room by a transgender student is, however, a purely speculative fact,” Justice LeRoy Millette Jr. wrote. “It is not clear what, if any, bathroom policies are being implemented, or even that Jack attends school with a single transgender student.”

Mat Staver, the founder and chairman of Liberty Counsel, represented the boy and Lafferty. Staver said that since the original lawsuit was filed, the boy has shared a bathroom with a student he believed to be transgender. He plans to file another lawsuit based on that fact.

“Once we get past of the hurdle of standing, and you get to the merits, it’s pretty clear that the school board does not have the authority to pass additional categories to the nondiscrimination laws,” Staver said.

Other students are also interested in suing the school board, Staver said.