A California bakery owner can refuse to make wedding cakes for same-sex couples, and forcing her to comply with their requests violates her rights to free speech and free exercise of religion, a judge ruled this week.

Judge David Lampe, of the Kern County Superior Court in California, said in a decision late Monday that a wedding cake is a form of protected artistic expression, the Washington Post reported.

"A wedding cake is not just a cake in a Free Speech analysis," Lampe wrote in his opinion. "It is an artistic expression by the person making it that is to be used traditionally as a centerpiece in the celebration of a marriage. There could not be a greater form of expressive conduct."

Therefore, California's Unruh Act, which bars discrimination in public accommodations, does not apply to Cathy Miller, owner of Tastries Bakery in Bakersfield.

But Lampe cautioned that freedom of speech and religion does not give businesses a right to refuse service to groups protected by the act in other circumstances, using a tire shop as an example.

"A retail tire shop may not refuse to sell a tire because the owner does not want to sell tires to same-sex couples," Lampe wrote. "No baker may place their wares in a public display case, open their shop, and then refuse to sell because of race, religion, gender, or gender identification."

The difference, according to the judge, is that "there is nothing sacred or expressive about a tire," while Miler is "a creative artist" who "participates in every part of the custom cake design and creation process."

Even though the couple did not ask Miller to design particular words on the cake, the "difference here is that the cake in question is not yet baked," according to the opinion. "The State asks this court to compel Miller to use her talents to design and create a cake she has not yet conceived with the knowledge that her work will be displayed in celebration of a marital union her religion forbids."

"For this court to force such compliance would do violence to the essentials of Free Speech guaranteed under the First Amendment," Lampe concluded.

The case arose after Eileen and Mireya Rodriquez-Del Rio filed a complaint with the California Department of Fair Employment and Housing against Miller for refusing to bake a cake for their wedding in October 2017. Miller, a devout Christian, refused to bake the cake on religious grounds, as she believes that same-sex unions "violate a Biblical command that marriage is only between a man and a woman," according to the opinion.

Miller offered to accommodate the couple by sending their order to another bakery, called Gimme Some Sugar, which would bake the cake. But the couple instead chose to file the complaint, alleging that their civil rights had been violated.

The department sided with the couple, arguing that Miller was in violation of the Unruh Act and that her First Amendment rights did not apply in this situation because baking the cake is a matter of "conduct," not "speech." The department also argued that the First Amendment protects only "those occasions where government requires a speaker to disseminate another's message," which was not the case here.

The agency sought a legal order forcing Miller to make the cake, but Lampe denied it.

"I am very happy to serve everything from my cases to anybody," Miller said after Monday's ruling. "But I cannot be a part of a celebration that goes against my lord and savior."

The couple's legal team is likely to appeal Lampe's ruling to a higher court.

Lampe's decision comes as the U.S. Supreme Court prepares to rule in a similar case involving a Colorado baker, Jack Phillips, who refused to make a wedding cake for a same-sex couple.

Phillips claims that his rights to free speech and free exercise of religion under the First Amendment give him the right to refuse wedding services to same-sex couples, despite the existence of laws similar to the Unruh Act.

The nation's highest court heard Phillips' case in December, and the Trump administration has expressed support for the baker.

Also in December, the Oregon Court of Appeals upheld a ruling that leveled a $135,000 fine against two Christian bakers who refused a similar request by a same-sex couple. In that case, the court ruled the bakers were in violation of a 2007 Oregon state law prohibiting discrimination in government employment and public accommodation. The court chose not to recognize the right to artistic expression for bakers in that case.