A U.S. federal court overturned a Ohio state ban on Wednesday that prevented transgender people from changing the sex designation on their birth certificates, in a victory for LGBT+ advocates who said the law led to discrimination and harassment.

The decision found that the ban, implemented by the Midwestern state in 2016, was unconstitutional.

Laws vary among U.S. states regarding trans people changing the sex on birth certificates, with some states requiring medical procedures to be completed.

Only the state of Tennessee does not allow trans people to change the sex on their birth certificate in any circumstance, although the law is under legal challenge.

U.S. District Judge Michael Watson noted in the ruling that before 2016, Ohio had permitted trans people to make such changes.

In the lawsuit, four Ohio residents, all transgender, claimed the inability to change their birth certificates opened them up to harassment “when their highly personal transgender status was forcibly disclosed” by having documentation that did not reflect their identities.

The ruling was a culmination of a two-year lawsuit filed on their behalf by the American Civil Liberties Union (ACLU) and the U.S. LGBT+ advocacy group Lambda Legal.

“Today’s ruling affirms that the state must recognize the dignity and true identity of every transgender Ohioan,” Elizabeth Bonham, staff attorney for the ACLU of Ohio.

“It is incredibly frustrating that our clients faced years of unlawful discrimination, but today we celebrate this victory as an acknowledgement to their commitment to justice.”

Opponents argued that allowing changes to birth certificates would make record-keeping harder and open up the possibility of fraud.

The state of Ohio can appeal the decision, and Ohio Attorney General’s office did not respond to a request for comment on whether it would do so.