A federal court just unleashed a massive decision in favor of gay rights.

In an 8-3 ruling, the US Court of Appeals for the Seventh Circuit on Tuesday concluded that federal civil rights law — specifically, the Civil Rights Act of 1964 — protects workers from discrimination based on sexual orientation. So, the court decided, it’s not legal in the US for an employer to discriminate against gay workers — making it the first federal appeals court to conclude that gay people are protected under existing civil rights law.

The argument: Federal civil rights laws prohibit sex discrimination, and this, based on the Seventh Circuit Court’s interpretation of the law, encompasses sexual orientation. “It would require considerable calisthenics to remove the ‘sex’ from ‘sexual orientation.’ The effort to do so has led to confusing and contradictory results,” Chief Judge Diane Wood concluded in the majority opinion.

The case related to Kimberly Hively, an openly lesbian woman who had applied for multiple positions at Ivy Tech Community College in Indiana, only to never be hired full time. She believed the rejections were related to her sexual orientation, so she filed a complaint with the federal Equal Employment Opportunity Commission and a lawsuit — arguing this anti-gay discrimination was illegal under federal law. The Seventh Circuit Court sided with her, reversing previous decisions on the topic.

The ruling does not apply nationwide, instead only applying to the Seventh Circuit, which is made up of Indiana, Illinois, and Wisconsin. And it could be reversed by the US Supreme Court — or affirmed, expanding the ruling to the rest of the country.

But it stands to be the biggest pro–gay rights legal decision since the Supreme Court in 2015 ruled in favor of marriage equality. After same-sex marriage, nondiscrimination protections have been widely viewed by LGBTQ advocates as the next big battle for equality. Despite decades of battles over the issue, the federal government and most states don’t have civil rights laws explicitly protecting people from discrimination based on their sexual orientation and gender identity.

“In many cities and states across the country, lesbian and gay workers are being fired because of who they love,” Greg Nevins, employment fairness program director for the LGBTQ advocacy group Lambda Legal, said in a statement. “This decision is gamechanger for lesbian and gay employees facing discrimination in the workplace and sends a clear message to employers: It is against the law to discriminate on the basis of sexual orientation.”

Previously, federal appeals courts had already made similar rulings for transgender workers, concluding that civil rights laws already protect against discrimination based on gender identity. The Seventh Circuit Court cited these previous rulings, noting that “[m]any other courts have found that gender-identity claims are cognizable under Title VII [of the Civil Rights Act].”

Again, these rulings will need to be affirmed by the Supreme Court or other federal appeals courts to truly become law of the land. But they could indicate the start of a broader wave of court decisions that, like marriage equality, effectively decide the next big battle for LGBTQ rights.

Most states don’t explicitly ban anti-LGBTQ discrimination

The ruling picks at a big gap in LGBTQ rights across America: Under federal and most states’ laws, LGBTQ people aren’t explicitly protected from discrimination in the workplace, housing, or public accommodations (such as restaurants, hotels, and other places that serve the public). This means that someone can be fired from a job, evicted from a home, or kicked out of a business just because an employer, landlord, or business owner doesn’t approve of the person’s sexual orientation or gender identity.

Similarly, federal and most states’ laws don’t explicitly ban anti-LGBTQ discrimination in schools.

But federal and state laws do ban discrimination based on race, religion, nationality, and sex in the workplace, schools, and other settings. This is what the Civil Rights Act and other federal and state civil rights laws that followed were about.

What activists want to do is expand the existing civil rights protections to also protect LGBTQ people.

Advocates argue federal civil rights laws should already protect LGBTQ people

Civil rights advocates claim, however, that federal law should already shield LGBTQ people from discrimination, because, they say, bans on sex discrimination also ban discrimination based on sexual orientation and gender identity.

According to advocates, discrimination against people based on their sexual orientation or gender identity is fundamentally rooted in prohibited sex-based expectations. For example, if someone discriminates against a gay man, that’s largely based on the expectation that a man should only love or have sex with a woman — a belief built on the idea of what a person of a certain sex should be like. Similarly, if someone discriminates against a trans woman, that’s largely based on the expectation that a person designated male at birth should identify as a man — again, a belief built on the idea of what a person of a certain sex assigned at birth should be like.

On the other side, opponents argue that LGBTQ nondiscrimination protections aren’t included in existing federal civil rights laws, because the authors of federal civil rights laws never believed or intended that bans on sex discrimination also ban discrimination based on sexual orientation and gender identity.

LGBTQ advocates, citing legal precedent, say that what the original laws’ authors believe or intended is irrelevant. Joshua Block, an attorney with the ACLU LGBT and HIV Project, cited a 1998 Supreme Court case, Oncale v. Sundowner Offshore Services Inc., in which the Court unanimously agreed that bans on sex discrimination prohibit same-sex sexual harassment. Same-sex sexual harassment was not something the authors of federal civil rights laws considered, but it’s something, the Supreme Court said, that a plain reading of the law protects.

“Oncale says that’s irrelevant whether [Congress] contemplated it,” Block previously told me. “This is literal sex discrimination. Whether or not that’s what Congress was focused on doesn’t make it any less a type of discrimination covered by the statute.”

On Tuesday, the Seventh Circuit Court of Appeals embraced this interpretation for sexual orientation in the workplace, as several other courts have already done so for gender identity. It’s now up to other federal courts, particularly the US Supreme Court, to affirm or reject the decision.

But even if courts all eventually conclude that statutory bans on sex discrimination do prohibit discrimination based on sexual orientation and gender identity, under federal law that would only create explicit protections in the workplace, housing, and schools — but not public accommodations. That’s because federal civil rights laws don’t ban sex discrimination in public accommodations. That leaves a hole in nondiscrimination laws to be settled even if courts ultimately come down in favor of LGBTQ rights.

Still, for now, the Seventh Circuit Court’s ruling gives LGBTQ advocates a historic victory.