Image copyright SAUL LOEB/Getty Images

The US Supreme Court appears divided over whether a civil rights law barring workplace discrimination applies to gay and transgender workers.

The top court heard arguments regarding two cases of alleged discrimination against gay employees, and a third involving transgender discrimination.

Protesters from both sides gathered outside the court as arguments began.

The cases may be a landmark for LGBT rights in the US, four years after gay marriage became legal nationwide.

The top court's liberal quartet indicated their agreement with the plaintiffs and the argument that LGBT workers should be covered by Title VII of the Civil Rights Act.

Of the conservative justices, only Trump-appointed Neil Gorsuch appeared sympathetic to the plaintiffs - an early signal that he may cast the decisive vote.

Decisions from the nine justices on America's highest court are due by next June.

Image copyright SAUL LOEB/Getty Images

What are the cases?

The first two cases have been consolidated as both address the purported discrimination of gay employees.

Donald Zarda, a skydiving instructor from New York, and Gerald Bostock, a former child welfare services co-ordinator from Georgia, both say they were fired because of their sexual orientation.

Mr Zarda, who died in a skydiving accident in 2014 , was dismissed after joking with a female client with whom he was tandem-diving not to worry about the close physical contact because he was "100% gay".

The company maintained he was fired because he shared personal information with a client, not because he was gay, but a court in New York ruled in Mr Zarda's favour.

Mr Bostock says he lost his job after joining a gay recreational softball league, thereby publicly revealing his sexual orientation.

His employer, Clayton County, said his dismissal was the result of "conduct unbecoming of a county employee".

Mr Bostock lost his discrimination case in a federal court in Atlanta.

Michigan funeral home employee Aimee Stephens says she was fired for coming out as transgender.

She had worked as Anthony Stephens for six years before writing a letter to colleagues saying she would return to work "as my true self, Aimee Australia Stephens, in appropriate business attire".

Two weeks later, Ms Stephens was fired for insisting to work in women's clothes.

In a court filing last year, the funeral home owner argued it wanted Ms Stephens to comply with a dress code "applicable to Stephens' biological sex".

A lower court sided with Ms Stephens.

The US Department of Justice under President Donald Trump has supported the employers in each case.

What's the legal background?

Title VII of the Civil Rights Act of 1964 forbids employers from discriminating against employees on the basis of sex as well as gender, race, colour, national origin and religion.

The legal arguments hinge on whether "sex" may apply to sexual orientation and gender identity.

So far, most federal appeals courts in the US have interpreted the law to exclude discrimination against lesbian, gay, bisexual and transgender people.

But two courts, in New York and Chicago, recently ruled that discrimination against LGBT people is a form of sex discrimination.

Conservative groups argue that sexual orientation and gender identity may not be equated to the forms of discrimination already delineated in the Civil Rights Act.

"Congress never intended sexual orientation or the personal feelings of transgender individuals to be included in the concept of sex discrimination," said Walker Wildmon, vice president for The American Family Association, in a statement.

He added that religious individuals should be allowed "to operate their businesses according to their deeply held religious beliefs" - a defence broadly dismissed by LGBT advocates.

"In 29 states, a person can be fired for their gender identity and sexual orientation," Human Rights Council press secretary Charlotte Clymer told the BBC. "It's not about religious freedom, it's about pushing LGBT people out of the public square."

"The fact that you can get married on Sunday and fired on Monday for being LGBTQ, I believe, presents a pretty massive problem for our community and for society," she said.

What happened in court?

The Supreme Court justices appeared divided on Tuesday on whether Title VII protects gay, lesbian and transgender employees.

Conservative Justice Samuel Alito said that if the provision is found to cover LGBT individuals, the court would be seen as deciding "a major policy question" - taking the place of the legislature.

Chief Justice John Roberts, sometimes seen as the ideological centre of the bench, was considered a possible swing vote on the issue.

He asked on Tuesday whether, if the court were to rule that sexual orientation is covered by Title VII, exemptions would be granted for employers with strong religious beliefs.

Of the conservative justices it was the Trump-appointed Mr Gorsuch who voiced sympathy for the fired workers, saying sex seemed to be a "contributing cause" for their dismissals.

He also seemed amenable to the argument that "sex" in the Civil Rights Act could be applied to sexual orientation, whatever Congress had in mind during the law's writing in 1964.

He later expressed concern, however, of judicial overstep. Echoing Mr Alito, Mr Gorsuch warned of "massive social upheaval" if the court were to rule in favour of LGBT workers, instead of allowing Congress to legislate on the subject.

But liberal Justice Sonia Sotomayor asked "at what point" a court could "continue to allow individuous discrimination".

She continued: "We can't deny that homosexuals are being fired just for who they are."

It is the first time the top US court has heard a case involving gay rights since 2018.

Since then the balance of the court has tilted to a 5-4 conservative majority, including Trump appointees Justice Neil Gorsuch and Justice Brett Kavanaugh.

The closely-watched Mr Kavanaugh has so far said little to indicate his stance.

Media playback is unsupported on your device Media caption The morning gay marriage came to the US

Tara McKelvey, BBC News, at the scene

Dozens of people demonstrated outside the Supreme Court building, holding signs that say: "Trans people belong", "We will fight back" and other slogans that underscore their message - gay and transgender rights should be protected in the workplace.

The issue being considered by the court has important legal implications, as activists explain, saying no-one should be sacked for being gay. The matter also has political implications - evangelical Christians, many of whom helped Trump get elected, think the laws should not change and are hoping the court will agree.

For Trump, the ruling will either provide a victory or a setback for his supporters. The progressive activists are naturally campaigning for a victory for their side. With that goal in mind, one activist is holding a sign: "Surrender Donald."