A state judge in Kentucky on Monday upheld the right of a printing company owned by devout Christians to refuse to produce T-shirts promoting a gay pride festival.

Circuit Judge James Ishmael reversed an October 2014 decision by a local human rights commission that found the company violated an anti-discrimination law when it declined to take an order for T-shirts from the Gay and Lesbian Services Organization (GLSO).

The judge cited both free speech and freedom of religion in ruling that the company did not discriminate when it declined to print T-shirts for an event promoting activities offensive to the owners’ religious beliefs.

“This court does not fault the Commission in its interest in insuring citizens have equal access to services but that is not what this case is all about,” Judge Ishmael said.

“There is no evidence in this record that [the company] or its owners refused to print the T-shirts in question based upon the sexual orientation of the GLSO or its members,” he said.

“Rather, it is clear beyond dispute that [the company] and its owners declined to print the T-shirts in question because of the MESSAGE advocating sexual activity outside of a marriage between one man and one woman.”

The state court decision comes one day before Kentucky and three other states are set to argue at the US Supreme Court that state laws restricting marriage to one man and one woman should be upheld.

Several friend-of-the-court briefs filed at the high court express concern that if it rules in favor of same-sex couples and invalidates traditional marriage laws across the country, religious conservatives who own small businesses will be forced to participate in same-sex weddings and other activities that they say offend their sincerely held religious beliefs.

A New Mexico photographer was found to have discriminated when she declined to photograph a same-sex couple’s commitment ceremony. She had cited her religious beliefs about marriage in declining the job.

A Colorado baker was cited for discrimination after he told a same-sex couple that he would sell them anything in his store, but would not produce a wedding cake for them. He said same-sex marriage offended his religious beliefs.

And a florist in Washington State was found to have discriminated against two gay men when she refused to arrange flowers for their wedding. The florist had sold flowers to one of the gay men for nine years, but she told her longtime customer that arranging flowers for the ceremony would involve her in an activity that her religion viewed as sacrilegious.

In each case, lawyers for religious business owners have sought to draw a distinction between selling existing products to people who happen to be gay or lesbian as part of a public accommodation versus engaging in expressive endeavors that promote activities they find religiously offensive.

In the Kentucky T-shirt case, an owner of the company, Hands On Originals, declined to accept an order for T-shirts promoting the 2012 Lexington Pride Festival because the event promoted sexual relationships and sexual activities outside of a marriage between one man and one woman.

The owner told a representative of the gay services group that he could not print the T-shirts because his company’s involvement in promoting the Pride Festival would disobey God.

Instead of filling the order, the owner offered to contact other local printing companies to do the work at the same price as Hands On Originals.

The gay services group was able to find another printer for the T-shirts. The group also filed a discrimination complaint against the company.

The Lexington-Fayette Urban County Human Rights Commission took up the case and ruled that the company’s refusal to print the T-shirts was discrimination based on sexual orientation.

The commission also found that the local fairness ordinance did not violate free speech rights or rights to the free exercise of religion.

In reversing that determination, Ishmael said the commission’s conclusions were “in direct contrast to well-established precedent.”

Hands On Originals has a First Amendment right to refuse to print T-shirts bearing a message that it finds offensive, the judge said.

In addition, he ruled that the company and its owners enjoy a right to freely exercise their religion, which includes not facing government actions that substantially burden those rights. Ishmael said there was no showing of a compelling government interest that would justify forcing company officials to violate their religious beliefs.

The judge said GLSO was able to obtain its T-shirts from another firm at a substantially reduced price or, perhaps, for free.

“Hands On Originals and its owners have a sincerely held Christian belief that it is contrary to the Holy Bible for persons to engage in sexual activities outside of a marriage between one man and one woman,” Ishmael wrote. “The Pride Festival is without dispute a strong advocate for sexual relationships outside that principle.”

He said that rather than discriminating, the printing company had consistently followed its own policy of not printing offensive messages.

The judge noted that during a three-year period, the company had refused 13 orders, including for shirts promoting a strip club, pens promoting a sexually explicit video, and shirts containing a violent message.

“The government can’t force citizens to surrender free-speech rights or religious freedom in order to run a small business, and this decision affirms that,” said Jim Campbell, a lawyer with the group Alliance Defending Freedom, who argued the case on behalf of the company owners.

“The court rightly recognized that the law protects [the company’s] decision not to print shirts with messages that conflict with [the owners’] beliefs, and that no sufficient reason exists for the government to coerce [the owners] to act against [their] conscience in this way,” he said.

The case is Hands On Originals v. Lexington-Fayette Urban County Human Rights Commission (14-CI-04474).