The Justice Department has filed an amicus brief in the U.S. Supreme Court in support of the Colorado baker who refused to sell a wedding cake to a same-sex couple.

The Supreme Court announced in June it would consider whether Jack Phillips, the owner of Masterpiece Cakeshop in Denver, acted lawfully when refusing to sell a wedding cake to David Mullins and Charlie Craig in 2012.

Phillips said baking a cake for a same-sex couple went against his religious beliefs. He was still found to have violated the Colorado Anti-Discrimination Act

"Forcing Phillips to create expression for and participate in a ceremony that violates his sincerely held religious beliefs invades his First Amendment rights in a manner akin to the governmental intrusion in Hurley," Acting Solicitor General Jeffrey Wall wrote in the brief.

In 1995, the Supreme Court ruled in Hurley v. Irish American Gay, Lesbian, and Bisexual Group of Boston that a private group of citizens organizing a public demonstration could not be compelled by the state government to include other groups whose message was contrary to their own.

"Colorado has not offered, and could not reasonably offer, a sufficient justification for that compulsion here," the brief reads.

Justice Department officials then argued that the baking of a cake is a service that is a form of expression and is thus protected under the First Amendment. A commercial banquet hall could not refuse to rent its facilities to a same-sex couple for a wedding because that is not expressive, the brief puts forth as an example.

A Justice Department spokeswoman said the brief filed Thursday is one backed by the First Amendment.

"The department filed an amicus brief in this case today 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. That includes the freedom not to create expression for ceremonies that violate one's religious beliefs," said spokeswoman Lauren Ehrsam.

In 2015, a Colorado appeals court ruled against Phillips, by saying that making the cake "does not convey a message supporting same-sex marriages merely by abiding by the law and serving its customers equally."

Phillips' lawyers argued in a prior Supreme Court brief that he "is happy to create other items for gay and lesbian clients," but that his religion compels him "to use his artistic talents to promote only messages that align with his religious beliefs."

On the same day the Supreme Court said it would hear Phillips' case, it also reaffirmed its 2015 decision ruling same-sex marriage as constitutional.

The majority decision in June was unsigned, and newly sworn-in Justice Neil Gorsuch dissented. He was joined by Justices Clarence Thomas and Samuel Alito Jr.

The new Justice Department brief adds to the stakes of the Supreme Court, which pits religious freedom and freedom of speech up against discrimination and the constitutional rights of same-sex couples.

Louise Melling, deputy legal director of the American Civil Liberties Union, said though the Trump administration's Justice Department had already made its "hostility" to the rights of LGBT people "crystal clear," Thursday's brief was "shocking."

"What the Trump Administration is advocating for is nothing short of a constitutional right to discriminate," Melling said in a statement. "We are confident that the Supreme Court will rule on the side of equal rights just as the lower courts have."

The ACLU is part of the team of lawyers helping to represent the Colorado Civil Rights Commission, Craig, and Mullins against the cake shop.