The Supreme Court announced Monday morning that a Colorado baker was protected by the Constitution when he refused to make a wedding cake for a gay couple.

A Colorado state commission had ruled against Jack Philips and was at the center of the Supreme Court case, Masterpiece Cakeshop V. Colorado Civil Rights Commission, No. 16-111, The New York Times reported.

Here is what you need to know about the potentially landmark case.

When did the case begin?

It all started in 2012. David Mullins and Charlie Craig went to Masterpiece Cakeshop in Lakewood Colorado. They were planning on marrying in Massachusetts but having a reception in Colorado. Philips said that he would not make a cake, because doing so would show that he agreed with same-sex marriage, which his religious views did not allow.

Craig and Mullins said they were embarrassed by not being able to have a custom wedding cake made at the shop, so they field a complaint with the state's civil rights commission. The couple said they were discriminated against based on sexual orientation, The New York Times reported.

The commission and the state courts agreed with Craig and Mullins.

How did the case get to the Supreme Court?

The case was heard by the Colorado Court of Appeals, which said that Phillips' right to free speech was not violated because both sides, the baker and the couple, hadn't discussed the cake before Phillips said no. The court also said that people wouldn't assume that Philips would be making a statement on whether or not he supported gay marriage by simply making a cake. He was still free to voice his opinion in any other setting, The New York Times reported.

Religious groups, however, said that the government shouldn’t force anyone to go against their principles to make a living.

>> Read more trending news

How did the Supreme Court rule?

It was a 7-2 decision, saying that the Constitution protected Philips's First Amendment rights of free speech. Justice Anthony Kennedy wrote for the majority that the Colorado Civil Rights Commission acted with "clear and impermissible hostility" to religious beliefs. He added that one commissioner went too far when the person said that "freedom of religion and religion has been used to justify all kinds of discrimination throughout history, either it be slavery, whether it be the Holocaust."

Kennedy said that “this sentiment is inappropriate for a commission charged with the solemn responsibility of fair and neutral enforcement of Colorado’s anti-discrimination law.”

The judgement was 7-2, but the opinion was 6-2, CNN reported.

Who wrote the dissent?

Justice Ruth Bader Ginsburg said that the remarks made by the commissioner were not enough to rule for Phillips.

“What prejudice infected the determinations of the adjudicators in the case before and after the commission? The court does not say,” Ginsburg wrote.

Who represented whom?

Alliance Defending Freedom represented Philips and said that the court’s ruling was a victory of religious liberty.

“Government hostility toward people of faith has no place in our society, yet the state of Colorado was openly antagonistic toward Jack’s religious beliefs about marriage,” Kristen Waggoner, a lawyer with Alliance Defending Freedom said.

"Jack serves all customers; he simply declines to express messages or celebrate events that violate his deeply held beliefs," Waggoner said in a statement, CNN reported.

But the American Civil Liberties Union represented Mullins and Craig and said that while the court ruled on the side of Philips, the court was also aware of and reaffirmed protections for the LGBTQ community.

"The court reversed the Masterpiece Cakeshop decision based on concerns unique to the case but reaffirmed its longstanding rule that states can prevent the harms of discrimination in the marketplace, including against L.G.B.T. people," Louise Melling, ACLU deputy legal director, told The New York Times.