The Supreme Court on Monday rejected an otherwise lawful exercise of the government’s power because the officials who carried it out had made hostile public remarks toward a person’s religious beliefs.

No, the justices didn’t strike down President Donald Trump’s travel ban that targeted several Muslim-majority countries. A decision in that case is still pending before the court’s term wraps up later this month. Instead, the court issued a judgment in Masterpiece Cakeshop v. Colorado Civil Rights Commission, which focused on whether the government could penalize a baker who refused on religious grounds to sell wedding cakes to gay couples.

The Masterpiece Cakeshop case looked like it would force the justices to choose between a Christian baker’s religious faith and a gay couple’s right to buy goods and services without facing discrimination. But in a 72 decision, the court resolved the dispute on narrower grounds by focusing on biased statements made by civil-rights commissioners in Colorado. In doing so, the justices ruled in favor of the baker without setting a broader precedent on the underlying matter.

“Whatever the confluence of speech and free exercise principles might be in some cases, the Colorado Civil Rights Commission’s consideration of this case was inconsistent with the State’s obligation of religious neutrality,” Justice Anthony Kennedy wrote for the majority.

Kennedy’s feat of legal legerdemain means that the Supreme Court has punted on deciding whether anti-discrimination laws that protect gay Americans must yield to a business owner’s religious tenets. For now, the question is one of moral and intellectual consistency: Will the justices hold the president to the same standard in the travel-ban case that they held Colorado’s civil-rights commissioners to in Masterpiece Cakeshop?

Monday’s decision sprang from events that long predated the travel ban or Trump’s presidency. In 2012, Charlie Craig and Dave Mullins visited Masterpiece Cakeshop, a bakery in Lakewood, Colorado, in search of their perfect wedding cake. Jack Phillips, the bakery’s owner, greeted the two men and Craig’s mother while they admired a selection of Phillips’s prior work. When they told him they were interested in buying a cake for their wedding reception, he told them he wouldn’t design or sell a wedding cake for them. Phillips told the court that he offered to sell them other baked goods, but the couple quickly left the shop.

Craig and Mullins filed a discrimination complaint against Phillips with state civil-rights regulators in September 2012, who referred the matter to the Colorado Civil Rights Commission. The commission ruled against Phillips in 2013 and ordered him not to refuse to sell wedding cakes to same-sex couples. Phillips challenged the ruling in Colorado’s state courts, which sided with the commission. After the Supreme Court agreed to hear his appeal, Phillips said the commission had disregarded the First Amendment’s role in a pluralistic society.

“The commission must respect Phillips’s freedom to part ways with the current majority view on marriage and to create his wedding cakes consistently with his ‘decent and honorable’ religious beliefs,” he told the justices. “Instead, the commission punished him, demeaned his beliefs, and marginalized his place in the community.”

Craig and Mullins disagreed, warning the justices that a ruling in Phillips’s favor would undermine gay Americans’ civil rights. “To recognize either of the bakery’s asserted First Amendment objections would run counter to the basic principle, reflected in over a century of public accommodation laws, that all people, regardless of status, should be able to receive equal service in American commercial life,” they told the court.

Both sides focused on these issues during oral arguments in December. At the same time, Kennedy foreshadowed what would eventually be the final outcome. “Suppose we thought that in significant part at least one member of the commission based the commissioner’s decision on the grounds of hostility to religion,” he asked Frederick Yarger, who represented the commission. “Could your judgment then stand?” (Yarger indicated that it could.)

On Kennedy’s mind were remarks made by one of the commissioners during a hearing on Phillips’s case, which appeared to cast doubt on the sincerity of the baker’s religious beliefs and even invoked slavery and the Holocaust:

I would also like to reiterate what we said in the hearing or the last meeting. Freedom of religion ... has been used to justify all kinds of discrimination throughout history, whether it be slavery, whether it be the Holocaust, whether it be—I mean, we—we can list hundreds of situations where freedom of religion has been used to justify discrimination. And to me it is one of the most despicable pieces of rhetoric that people can use to—to use their religion to hurt others.

To Kennedy, those remarks represented a “clear and impermissible hostility” toward Phillips’s faith. “This sentiment is inappropriate for a commission charged with the solemn responsibility of fair and neutral enforcement of Colorado’s anti-discrimination law—a law that protects discrimination on the basis of religion as well as sexual orientation,” he wrote. By “sitting in judgment of his religious beliefs,” the commission had violated the baker’s First Amendment rights, Kennedy concluded.

So why would any of this matter for Trump’s travel ban? Because during oral arguments in April, Kennedy asked a question of the Trump administration that sounds remarkably similar to the one he posed for the commission in Masterpiece Cakeshop. “Suppose you have a local mayor and, as a candidate, he makes vituperative, hateful statements, he’s elected, and on day two, he takes acts that are consistent with those hateful statements,” Kennedy asked Solicitor General Noel Francisco, who argued on behalf of the Trump administration. “Whatever he said in the campaign is irrelevant?” (Francisco answered in the affirmative.)

If anything, Trump’s remarks on the campaign trail present far more damning evidence of religious animus than anything said by a Colorado civil-rights commissioner. Trump first proposed the ban in December 2015 by explicitly calling for a “total and complete shutdown” of Muslim travelers from entering the United States. Trump later began calling it “extreme vetting,” but Rudy Giuliani, who now serves as Trump’s personal lawyer in the Russia investigation, said in an interview last year that the president had asked him for advice on the “Muslim ban” legally.

There would be a certain elegance to a Supreme Court ruling that invalidates Trump’s executive order by narrowly focusing on his specific remarks. The court would still be able to strike down what was clearly a discriminatory act motivated by animus towards Muslims. At the same time, the justices could avoid a thicket of thorny constitutional questions—in this case, about the president’s national-security powers to restrict immigration, how much justification he needs to use them, and what limits can be placed on them beyond those imposed by Congress.

In Masterpiece Cakeshop, the court recognized that it can invalidate what it views as an official act of religious discrimination without delving too deeply into other legal issues surrounding the dispute. “The Commission’s hostility was inconsistent with the First Amendment’s guarantee that our laws be applied in a manner that is neutral toward religion,” Kennedy concluded. The court will announce by the end of June whether that guarantee extends to Muslims as well.