Judge Andrew Napolitano said that the Supreme Court's ruling in favor of a baker who refused to craft a wedding cake for a same-sex couple could set a precedent for religious discrimination in future cases.

The Supreme Court on Monday ruled in favor of baker Jack Phillips in a 7-2 decision, after the couple filed charges against him in 2012.

Phillips had refused to bake the couple's wedding cake due to his religious beliefs against gay marriage.

"I think this is a dangerous opinion," Napolitano said of the ruling on "America's Newsroom."

"It will allow others to say, 'My religious beliefs prohibit me from dealing with women or Italians or African-Americans,' and they will base it on the logic in this case," he explained.

Booker Grills Pompeo on Gay Marriage Opposition: 'Is Being Gay a Perversion?'

Phillips was sanctioned by the state civil rights commission after a formal complaint from the couple.

"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," wrote Justice Anthony Kennedy in his majority opinion.

President Trump's administration had backed Phillips, who was represented in court by conservative Christian nonprofit Alliance Defending Freedom.

'It's Disputed by Our Founding Fathers': Paul Challenges Pompeo on Syria, Military Deployments

Same-Sex Marriage: Should Courts or States Decide?

'A Rogue SCOTUS Decision': Santorum Says Gay Marriage Has No Constitutional Basis