A federal judge ruled Wednesday that Kentucky must recognize same-sex marriages performed in other states, striking down part of the state’s ban on gay marriages.

U.S. District Judge John G. Heyburn II ruled that failing to recognize marriages performed in other states means that Kentucky is treating gay and lesbian couples in a “way that demeans them,” the Associated Press reports. The ruling invalidates a key part of Kentucky’s gay marriage ban, a constitutional amendment approved by voters in 2004.

The decision stemmed from lawsuits brought by gay and lesbian couples who were married out of state, but Heyburn did not rule on the legality of same-sex marriage itself in Kentucky.