Image copyright AP Image caption Critics of the the law said it discriminated against same-sex couples, transgender people and others

A US judge has blocked a Mississippi law protecting religious objections to same-sex marriage a day before it was set to take effect.

It favoured some religious beliefs over others and would mean unequal treatment for gay people, the judge said.

The measure was intended to protect people who objected on religious grounds to gay marriage, extramarital sex and changing gender.

State attorneys are expected to appeal the ruling.

US District Judge Carlton Reeves issued the injunction blocking the law from taking effect on Friday.

Mississippi's "Protecting Freedom of Conscience from Government Discrimination Act" would have allowed those who cite religious beliefs to refuse a broad range of services to lesbian, gay, bisexual and transgender people.

Critics have said the law is so broad it could apply to almost anyone outside of a heterosexual marriage, affecting business practices, adoptions, foster care, school bathroom policies and marriage licences.

"The state has put its thumb on the scale to favour some religious beliefs over others," Judge Reeves wrote, adding that it violated the Constitution's equal protection guarantee.

Media playback is unsupported on your device Media caption Republican Governor Phil Bryant signed the law despite criticism that it discriminates

Republican Mississippi Governor Phil Bryant, who signed the bill into law in April, said he was disappointed at the ruling.

"Like I said when I signed House Bill 1523, the law simply provides religious accommodations granted by many other states and federal law," Bryant said.

"I am disappointed Judge Reeves did not recognise that reality. I look forward to an aggressive appeal."

More than a dozen US states have passed or considered "religious liberty" laws in response to last June's historic Supreme Court decision to legalise gay marriage nationwide.