The US Supreme Court on Monday ended the first legal challenge to a Republican-backed Mississippi law that permits businesses and government employees to refuse to serve lesbian, gay, bisexual and transgender people because of their religious beliefs.

The justices left in place a June ruling by the New Orleans-based 5th US Circuit Court of Appeals that the plaintiffs — same-sex couples, civil rights advocates including the head of the state NAACP chapter, a church and others — did not have legal standing to bring the lawsuit.

The law, passed by the Republican-controlled state legislature and signed by Republican Governor Phillip Bryant with the backing of conservative Christian activists, has not yet been implemented and more legal challenges are expected, according to gay rights lawyers.

"We will keep fighting in Mississippi until we overturn this harmful law, and in any state where antigay legislators pass laws to roll back LGBT civil rights," said Beth Littrell, a lawyer with the gay rights group Lambda Legal.

People who are refused service once the law is in place may be more likely to be judged to have legal standing to sue.

The 2016 law was passed in the aftermath of the US Supreme Court's landmark 2015 ruling legalizing same-sex marriage nationwide.

Supporters call it a religious liberty law that protects the sincerely held religious beliefs and moral convictions of individuals and businesses. Opponents said it authorizes discrimination against LGBT people in violation of the US Constitution's guarantees of equal protection under the law and the separation of church and state.

Conservative Christian legal group Alliance Defending Freedom is helping the state defend the law.

"Good laws like Mississippi’s protect freedom and harm no one,” said Kevin Theriot, one of the group's lawyers.

Mississippi's law was one of a series of measures proposed in socially conservative, Republican-dominated states that gay rights advocates viewed as an attempt to undermine the high court's gay marriage ruling.

The law, called the Protecting Freedom of Conscience from Government Discrimination Act, protects the beliefs that marriage is the union of one man and one woman, sex outside such a marriage is improper and gender is determined by anatomy and genetics at birth and cannot change.

Among other things, the measure lets businesses refuse to provide marriage-related services to same-sex couples and allows judges, magistrates and justices of the peace to refuse to perform same-sex weddings.

The measure was blocked in 2016 by a Mississippi-based federal judge who said it unconstitutionally allowed "arbitrary discrimination" against LGBT people and unmarried people. The 5th Circuit overturned that ruling.

On a related issue, the Supreme Court is due to rule by the end of June whether a Colorado baker was within his constitutional rights to refuse to make a wedding cake for a gay couple on the basis of his conservative Christian beliefs.

Lawrence Hurley of Reuters reported from Washington.