WASHINGTON - The Supreme Court appeared divided Tuesday about whether federal discrimination laws protect gay and transgender workers, and President Donald Trump's appointments to the court could play the pivotal roles in deciding the outcome.

The issue, one of the most significant facing the court this term, concerns the reach of Title VII of the Civil Rights Act of 1964, which, besides protecting against workplace discrimination because of race, religion and other characteristics, also prohibits discrimination "because of sex." The court has since interpreted that definition to include discriminating on the basis of sex stereotypes.

The arguments touched on some of the most controversial issues of the day - whether it would mean the end of same-sex bathrooms, whether men should be able to compete on female athletic teams, whether dress codes for men and women would become a thing of the past.

The word "transgender" made its first appearance in a Supreme Court argument, as did "cisgender" - the term for a person whose gender identity matches how they were identified at birth - and the gender-ambiguous character "Pat" from "Saturday Night Live" skits that aired during the 1990s. Chief Justice John Roberts Jr., whose questions in court gave no signal about his views on the case, was careful with pronouns, at one point using the neutral "they" to refer to an individual.

Lawyers for the gay and transgender individuals challenging their firings seemed to pitch their arguments to Justice Neil Gorsuch, a conservative who advocates a close textual reading of statutes. During the sexual orientation arguments, he pushed lawyers for the government and the employers to acknowledge that sex seemed to be at least a "contributing cause" to the terminations.

But during arguments in the transgender case, he wondered if "when a case is really close," courts should make decisions that might cause "massive social upheaval" rather than leave it up to Congress.

Justice Brett Kavanaugh, the court's newest member, kept a low profile during the two hours of argument, asking only one question.

There seemed little doubt that the court's four liberal members would find that Title VII covered gay and transgender workers. But one of the court's five conservatives would have to join them to form a majority.

The court combined two cases to consider whether gay workers are protected under the law. Gerald Bostock claims he was fired from his job as a social worker in Clayton County, Georgia, after he became more open about being gay, including joining a gay softball league. Donald Zarda said he was fired as a skydiving instructor after joking with a female client to whom he was strapped for a tandem dive that he was gay. (Zarda died in 2014.)

Stanford University law professor Pamela Karlan, representing the two gay employees, said the court need not update the 1964 law to find that sex plays a role when someone is fired because of sexual orientation.

She gave an example of two employees who told their boss they had married "Bill" over the weekend.

"When you fire the male employee who married Bill and you give the female employee who married Bill a couple of days off so she can celebrate the joyous event, that's discrimination because of sex," Karlan said.

Justice Ruth Bader Ginsburg at times seem to throw objections at Karlan so she could bat them down.

"Ms. Karlan, how do you answer the argument that back in 1964, this could not have been in Congress' mind because in many states male same-sex relations was a criminal offense; the American Psychiatric Association labeled homosexuality a mental illness," Ginsburg said.

"Well, I think you read the words of the statute," Karlan replied. "And this court has recognized again and again forms of sex discrimination that were not in Congress' contemplation in 1964," mentioning sexual harassment and stereotypes.

The questioning from Justice Samuel Alito Jr. was not so benign. He said the plaintiffs wanted the court to do what Congress would not.

"Congress has been asked repeatedly in the years since 1964 to address this question. The Equality Act is before Congress right now," Alito said. "Congress has declined or failed to act on these requests. And if the court takes this up and interprets this 1964 statute to prohibit discrimination based on sexual orientation, we will be acting exactly like a legislature."

Jeffrey Harris, the lawyer for the employers, and Solicitor General Noel Francisco, representing the Trump administration, made precisely that argument. Sex and sexual orientation, Harris said, are independent and distinct characteristics.

"That is just as true today as it was in 1964" when Congress passed the law, which he said did not include protections for gay people.

Added Francisco: "Sex means whether you're male or female, not whether you're gay or straight. So if you treat all gay men and women exactly the same because of their sex, you're not discriminating against them because of their sex."

Justice Elena Kagan said Francisco had the test wrong and discounted his view that Congress did not mean to cover sexual orientation.

"For many years, the lodestar of this court's statutory interpretation has been the text of a statute, not the legislative history, and certainly not the subsequent legislative history," she said. "And the text of the statute appears to be pretty firmly in Ms. Karlan's corner. Did you discriminate against somebody, against her client, because of sex?"

Roberts asked the workers' attorney what new protections would mean for religious organizations. Karlan responded that exemptions already exist for those with religious objections to hiring gay workers.

The questions about single-sex bathrooms and gender-specific dress codes came up mostly in the case involving Aimee Stephens, who worked for years at a Michigan funeral home before being fired after informing the owners and colleagues of her gender transition.

American Civil Liberties Union legal director David Cole, representing Stephens, said the court will still face difficult questions about restrooms and athletic teams no matter how it rules in these cases.

But he said Stephens' firing fit squarely within the law's wording "because of sex." She was fired, he said, "because she had a male sex assigned at birth."

Gorsuch questioned whether by siding with Stephens the court could mean "something as drastic a change in this country as bathrooms in every place of employment and dress codes in every place of employment that are otherwise gender neutral would be changed."

Cole said federal courts have recognized discrimination against transgender people as a form of sex discrimination for 20 years.

"There are transgender male lawyers in this courtroom following the male dress code and going to the men's room," he noted. "The court's dress code and sex-segregated restrooms have not fallen."

John Bursch of the Alliance Defending Freedom, representing the funeral home, made arguments similar to those in the other case: "Treating women and men equally does not mean employers have to treat men as women. That is because sex and transgender status are independent concepts."

He portrayed Cole's arguments as far-reaching. It would mean, he said, "that a women's overnight shelter must hire a man who identifies as a woman to serve as a counselor to women who have been raped, trafficked, and abused and also share restroom, shower, and locker room facilities with them. That is because, but for the man's sex, he would be allowed to hold that job and to use those facilities."

Ginsburg said there is a difference between treating men and women differently, and discrimination.

"Most people are not injured by having separate bathrooms," she said. "In fact, most people would prefer it."

The Trump administration's position puts it at odds with the Equal Employment Opportunity Commission, which decided in 2015 that gay and transgender individuals were federally protected.

Treating a man who is attracted to men differently from a woman who is attracted to men is discrimination, the EEOC reasoned.

The commission also looked at a 1989 Supreme Court decision that said federal law protected against discrimination based on stereotypes; the court found for a woman who had not been promoted because her employers found her too aggressive and her manner of dress not feminine enough.

That is analogous to discriminating against a transgender individual, the commission said. And discrimination because of sexual orientation is the same thing, the EEOC said, because it relies on stereotypes about to whom men and women should be attracted.

Gay rights leaders say "married on Sunday, fired on Monday" is a possibility in more than half of the United States, where there is no specific protection for gay or transgender workers. The states that prohibit discrimination are not uniform - some protect only gender identity or transgender status, and some differentiate between public and private employment.