On Monday, a federal appeals court in Manhattan ruled that a provision of the 1964 Civil Rights Act banning workplace discrimination due to sex bias also prohibits anti-gay discrimination. Today’s decision comes as a judicial defeat over the Trump administration, which argued against the gay worker in the case and issued an unsolicited court briefing in 2017 arguing that the Civil Rights Act was not intended to provide protections to gay workers.

Today’s court case concludes a more than eight-year legal battle started in 2010 when Donald Zarda, a Long Island-based skydiving instructor, sued his former employer, Altitude Express, Inc., for allegedly firing him because of his sexual orientation. In his suit, Zarda successfully argued that his termination violated Title VII of the Civil Rights Act, which bans workplace discrimination on the basis of “race, color, religion, sex, or national origin.”

Although Zarda died in 2014, his sister and close friend chose to continue the lawsuit in his name. Lawyers from the Equal Employment Opportunity Commission (EEOC), the federal agency that handles workplace civil rights disputes, supported Zarda’s estate in the appeals process , arguing in court that gay employees should be protected under the Civil Rights Act because discrimination against sexual orientation falls under sex-based discrimination. As Buzzfeed reports, an EEOC lawyer told the judges at a September hearing, “Sex stereotyping says that if you are a man attracted to a man, or a woman attracted to a woman, you’re not behaving the way those genders are supposed to behave.”

It’s been the EEOC’s official position that the Civil Rights Act should cover sexual orientation since 2015. The amicus brief filed by Trump’s Department of Justice last year, however, stated that the EEOC did “not [speak] for the United States.”

“Today’s ruling is the latest victory in affirming that employees should be evaluated only on their work ethic and job performance, not on who they are or who they love."

While 19 states and the District of Columbia currently have their own workplace nondiscrimination protections for LGBT people and more than 50 US cities have implemented LGBT nondiscrimination measures since 2015, there have been no protections implemented at the federal level, leaving these disputes to be battled in the courts.

Today’s 10-3 decision by the Court of Appeals for the 2nd Circuit follows a landmark 2017 case in which the 7th Circuit Court of appeals ruled that an Indiana teacher who claimed she was fired from Ivy Tech Community College because she is a lesbian was protected by Title VII. Before that case, however, previous legal precedent has overwhelmingly found that Title VII does not cover sexual orientation. When the question arose in cases presided by the 2nd Circuit Court in 2000 and 2005, the court ruled that “sex” means biological gender, not sexual orientation.

Now, almost 13 years since the 2005 ruling, Chief Judge Robert A. Katzmann wrote, “We now conclude that sexual orientation discrimination is motivated, at least in part, by sex and is thus a subset of sex discrimination.”

Prior to the ruling, anti-discrimination advocacy group, Freedom For All Americans, rallied a number of large corporations including Google, Microsoft, CBS, and Viacom, to sign a statement in support of Zarda’s suit.

“Today’s ruling is the latest victory in affirming that employees should be evaluated only on their work ethic and job performance, not on who they are or who they love,” said Masen Davis, the CEO of Freedom for All Americans, in a statement published on the campaign’s website.

While the ruling only applies to the 2nd circuit’s domain, which includes the states of New York, Vermont, and Connecticut, it represents a broader challenge to the Trump Administration’s attempts to roll back protections for LGBT Americans.

The fact that Trump’s Department of Justice intervened in Zarda’s appeals process, even though it wasn’t a party to the lawsuit, is not typical. However, the Trump administration’s interest in the case in unsurprising. In February of last year, the Department of Justice rescinded Obama-era policies that allowed transgender students to use bathrooms and locker rooms that align with their gender identity, and in September 2017, sided in favor of a baker who refused to bake a wedding cake for a gay couple.