Voters in suburban Chicago rejected a slate of school board candidates who had been critical of the district’s transgender-friendly locker room policy, delivering a victory for the transgender rights movement in an election that had grabbed widespread attention.

Voters in the Palatine-Schaumburg high school district reelected two incumbents, Anna Klimkowicz and Robert LeFevre, and a third candidate, Ed Yung, who were supportive of a policy allowing a transgender girl born with male anatomy to use the girl’s locker room. A long-running debate about the policy, the result of an agreement between the district and former president Barack Obama’s Education Department, led to a high-profile lawsuit and put this usually sleepy election in the national limelight.

Transgender rights advocates — who have seen their momentum slow with the election of a Republican president and amid concerns about transgender bathroom and locker room use — cheered the vote as a validation of their view that people by and large support the right of transgender people to use the facilities where they feel most comfortable.

“What Tuesday’s election results have shown us … is that standing up for the LGBTQ community is not just the right thing to do, it is also good politics,” Brian C. Johnson, head of Equality Illinois, said in a statement.

Critics of the policy, including a local group called Parents for Privacy, had said it gave the transgender student preferential status, disregarding the needs of peers who might feel uncomfortable or unsafe changing in the same locker room as a person they consider a member of the opposite sex. They filed suit over the policy and threw their support behind the challengers: Ralph Bonatz, Katherine David and Jean Forrest.

In an interview with the Daily Herald, Bonatz said he was optimistic despite the defeat. “As a team, we think we did everything we could,” he told the publication.

The policy might yet be threatened, as the Parents for Privacy lawsuit is still working its way through the courts. The Trump administration has signaled it does not necessarily believe that federal law requires that transgender students be permitted to use the restroom and locker room of their choice, which had been the Obama administration’s stance and the basis for the agreement.