WASHINGTON — After working for more than a decade as an advocate for at-risk children in Clayton County, Georgia, outside Atlanta, Gerald Bostock was fired when he joined a gay softball league.

On Tuesday, in one of the most important cases of its new term, the U.S. Supreme Court will consider whether existing federal law forbids job discrimination on the basis of sexual orientation.

"I was fired for being gay. I lost everything. I lost my livelihood. I lost my source of income, I lost my medical insurance," Bostock said. "I was devastated."

A provision of federal law, Title VII of the Civil Rights Act of 1964, makes it illegal for employers to discriminate because of, among other factors, a person's sex. But the lower federal courts are divided on whether that language also covers sexual orientation.

Brian Sutherland, an Atlanta lawyer representing Bostock, said it does. "One simply cannot consider an individual's sexual orientation without first considering his sex. A gay man is only a gay man if he's attracted to other men." It cannot be the law "that a gay man or lesbian woman can be married to their partner on Sunday and legally fired for it on Monday," Sutherland argued.

In response, the state of Georgia says Congress never intended to include sexual orientation when passing the law more than half a century ago. More than 50 efforts have failed since then to change the law and make that coverage explicit. The U.S. Justice Department agrees with the state, in a reversal from the position it took during the Obama administration.

"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 the Supreme Court that no longer includes Justice Anthony Kennedy, who wrote all of the court's significant gay rights decisions. He 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."

The court will also consider 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," said John Bursch of the Alliance Defending Freedom, a conservative legal group representing her former employer.

But the American Civil Liberties Union said even if the meaning of 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.

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

Across the nation, 21 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 LGBTQ cases. But if the court rules that it does, then the protection would apply nationwide.