A divided U.S. Supreme Court ruled that federal law protects gay and transgender workers from job discrimination in a pair of decisions that give millions of LGBT people new civil rights.

Conservative Justice Neil Gorsuch and Chief Justice John Roberts joined the court’s four liberals in a 6-3 majority, interpreting the longstanding federal ban on sex discrimination in the workplace to cover bias on the basis of sexual orientation and gender identity.

The decisions could have a broad practical impact. More than half the U.S. states don’t cover sexual orientation and gender identity through their own anti-discrimination laws. More than half the nation’s 8 million LGBT workers live in those states, according to the UCLA School of Law’s Williams Institute.

The victory for LGBT rights comes even after the Supreme Court shifted to the right with two appointments by President Donald Trump.

The cases tackled a central irony in the fight over LGBT rights. Even though the Supreme Court legalized same-sex marriage nationwide in 2015, LGBT people still could have been fired from their jobs in much of the country.

This article was provided by Bloomberg News.