The US Supreme Court has delivered a landmark victory for the gay and transgender communities when it ruled that employers cannot discriminate against workers because of their sexual orientation.

In a blow to the administration of President Donald Trump, the court ruled by six votes to three that Title VII of the Civil Rights Act of 1964, which outlaws discrimination against employees because of a person's sex, also covers sexual orientation and transgender status.

"Today we must decide whether someone can be fired simply for being homosexual or transgender," the court said. "The answer is clear."

Gerald Bostock, one of the plaintiffs, said he was in "shock."

"But trust me when I say my heart is just full, I am so excited and happy," he said.

"No one has to be fearful going to work, fearful that they could lose their job because of who they are, who they love or how they identify," Mr Bostock said, though he noted there was still "a lot of work to be done."

Trump's administration had effectively thrown in its lot with employers, but the president later called the ruling "very powerful."

Lesbian, gay, bisexual and transgender rights activists, as well as Democratic politicians and several major businesses, had been demanding that the court spell out that the community was protected by the law. 

"This is a huge victory for LGBTQ equality," said James Esseks, director of the American Civil Liberties Union's LGBTQ & HIV Project. 

The group uses the longer version of the acronym, in which the Q stands for "questioning" -- as in still exploring one's sexuality -- or "queer."

"The court has caught up to the majority of our country, which already knows that discriminating against LGBTQ people is both unfair and against the law," he said in a statement. 

Joe Biden, the Democratic nominee for president, hailed the decision as "a momentous step forward for our country."
Mr Biden was vice president when the court made its historic ruling in favour of same sex marriage in 2015.

Rights activists had feared that Mr Trump's appointment of two new conservative judges to the top court could hinder further wins for their cause.

President Donald Trump's first Supreme Court appointee, Neil Gorsuch

Yet it was one of them, Neil Gorsuch, who wrote the majority decision, joining with the court's four progressive-leaning judges and Chief Justice John Roberts.

"An employer who fires an individual for being homosexual or transgender fires that person for traits or actions it would not have questioned in members of a different sex. Sex plays a necessary and undisguisable role in the decision, exactly what Title VII forbids," Mr Gorsuch wrote.

"Those who adopted the Civil Rights Act might not have anticipated their work would lead to this particular result," Mr Gorsuch said.
"But the limits of the drafters' imagination supply no reason to ignore the law's demands."