WASHINGTON — The Supreme Court appeared to be closely divided after hearing two hours of courtroom arguments Tuesday on one of the most important issues of the term: whether existing federal law forbids job discrimination on the basis of sexual orientation.

The court must decide whether Title VII of the Civil Rights Act of 1964, which makes it illegal for employers to discriminate because of a person's sex, also covers sexual orientation and transgender status.

"When an employer fires a male employee for dating men but does not fire female employees who date men, he violates Title VII," Pam Karlan of Stanford Law School said, arguing on behalf of Gerald Bostock, who was fired from a county job in Georgia after he joined a gay softball team. "The employer has discriminated against the man because it treats that man worse than women who want to do the same thing. And that discrimination is because of sex."

The court's conservatives were skeptical, many noting that sexual orientation was not on the mind of anyone in Congress when the civil rights law was passed 55 years ago.

If the court ruled the law does cover that, conservative Justice Samuel Alito said, people will say "that whether Title VII should prohibit discrimination on the basis of sexual orientation is a big policy issue, and it is a different policy issue from the one that Congress thought it was addressing in 1964."

Justice Ruth Bader Ginsburg said, however, that Congress wasn't thinking about sexual harassment then, either, but the courts later ruled that it is also prohibited by the civil rights law.

Justice Ginsburg. Art Lien

And Justice Sonia Sotomayor, another court liberal, asked: "At what point does a court continue to allow invidious discrimination? We can't deny that homosexuals are being fired just for who they are."

With the court so divided, the controlling vote could turn out to be Justice Neil Gorsuch, a Trump appointee, who seemed receptive to the argument that no matter what Congress had in mind in 1964, the words of the law would apply to sexual orientation, if not transgender status as well.

Regardless of whether discrimination simply against gay people of either sex is covered by the law, he said, "Isn't sex also in play here, and isn't that enough?”

But Gorsuch also wondered whether the court should “take into consideration the massive social upheaval that would be entailed” in a decision that Title VII covers sexual orientation.

Justice Gorsuch. Art Lien

Bostock has said he has no doubt why he was dismissed from the county job he held for a decade. "I was fired for being gay. I lost everything. I lost my livelihood. I lost my source of income. I lost my medical insurance," he said.

The Trump administration said Title VII does not cover cases like his, a reversal from the position the Obama administration took.

"The ordinary meaning of 'sex' is biologically male or female; it does not include sexual orientation," the government said in its written brief. "An employer who discriminates against employees in same-sex relationships thus does not violate Title VII as long as it treats men in same-sex relationships the same as women in same-sex relationships."

The case comes to a Supreme Court that no longer includes Anthony Kennedy, who wrote all of its significant gay rights decisions. Kennedy was succeeded by Justice Brett Kavanaugh, who has no record of ruling on the issue but who is generally more conservative than Kennedy.

A companion case involves a New York skydiving instructor, Donald Zarda, who was fired after he told a female client, who wondered about being strapped so tightly to him during a jump, not to worry because he is "100 percent gay."

Transgender rights

The court also considered whether Title VII outlaws discrimination against transgender employees. A federal appeals court ruled that Aimee Stephens was impermissibly fired from her job at a Michigan funeral home two weeks after she told her boss she is transgender. The company said she failed to follow the dress code.

"The funeral home would have treated a woman who wanted to dress and present as a man, with grieving family members and clients of the funeral home, exactly the same way that Stephens was treated," says John Bursch of the Alliance Defending Freedom, a conservative legal group representing her former employer.

But David Cole of the American Civil Liberties Union told the justices Tuesday that even if Title VII is confined to biological sex, it still makes her firing illegal. If she had been "assigned a female rather than a male sex at birth," she would not have been fired for living openly as a woman, Cole said.

The funeral home also fired her for failing to conform to its views of how men and women should dress and act, the group says, contrary to longstanding court rulings that forbid firing employees because of sex-based stereotypes, Cole said.

Across the nation, 22 states have their own laws prohibiting job discrimination based on sexual orientation or gender identity. Seven more provide that protection only to public employees. Those laws would remain in force if the Supreme Court rules that Title VII does not apply in LGBT cases. But if the court rules that it does, then the protection would apply nationwide.