US President Donald Trump (Win McNamee/Getty)

White House Press Secretary Sarah Huckabee Sanders has celebrated the Supreme Court’s ruling in favour of a baker who refused to serve a gay couple.

The court ruled 7-2 in favour of Colorado’s Masterpiece Cakeshop on Monday.

Bakery owner Jack Phillips launched a legal challenge to state anti-discrimination laws after refusing to serve gay couple David Mullins and Charlie Craig when he found out they were celebrating their wedding.

The court’s narrow opinion avoided setting a wider precedent of what discrimination is permissible in the name of religious freedom, though it did find that the Colorado Civil Rights Commission’s actions in ordering Phillips to serve gay customers was discriminatory.

The ruling was celebrated by White House Press Secretary Sarah Huckabee Sanders, who said the Trump administration was “pleased” by the result in her daily press conference.

Sanders said: “When it comes to the bakers, we were pleased with the Supreme Court’s decision.

“The First Amendment prohibits government discriminating against the basis of religious beliefs, and the Supreme Court rightly concluded that the Colorado Civil Rights Commission failed to show tolerance and respect for his religious beliefs.”

However, Sanders was caught in a bind when Peter Alexander of NBC News asked why the president’s support for “free speech” did not extend to NFL athletes making protests about racism. Trump has called for harsh sanctions for players who protest by kneeling during the national anthem.

Alexander asked: “If the White House supports the baker’s right of free speech, why doesn’t the White House support the players’ right to free speech?”

Sanders responded: “The president doesn’t think that this is an issue simply of free speech. He thinks it’s about respecting the men and women of our military. It’s about respecting our national anthem. And it’s about standing out of pride for that.”

The Trump administration filed a legal brief in support of Masterpiece Cakeshop which supported the right of business owners to discriminate against LGBT customers.

The Justice Department delivered oral arguments as part of the baker’s defence, arguing that it has a “substantial interest” in the case to protect “free expression.”

The department said ruling against the bakery could create an “intrusion” against the First Amendment “where a public accommodations law compels someone to create expression for a particular person or entity and to participate, literally or figuratively, in a ceremony or other expressive event.”

An official said the administration intervened “because the First Amendment protects the right of free expression for all Americans.”

“Although public-accommodations laws serve important purposes, they — like other laws — must yield to the individual freedoms that the First Amendment guarantees,” the official added.

“That includes the freedom not to create expression for ceremonies that violate one’s religious beliefs.”

The baker was defended by hardline anti-LGBT law firm Alliance Defending Freedom, which has sought to undermine LGBT rights protections in a number of states.

Though the ADF framed the issue around a religious objection to same-sex marriage, their other cases show a much wider support for anti-LGBT discrimination.

The law firm has sued a school district over a transgender non-discrimination policy, and defended a T-shirt printer who refused an order from a Pride celebration.