(CNN) A 2013 Phoenix law that adds "sexual orientation, gender identity or expression" to the city's nondiscrimination ordinance violated the freedom of speech and religious beliefs of two business owners, the Arizona Supreme Court said in a 4-3 ruling Monday.

Wedding invitation designers Joanna Duka and Breanna Koski, owners of Brush & Nib Studio, filed a lawsuit to challenge the city ordinance out of fear they'd be put in jail for refusing to create custom invitations that "celebrate same-sex marriage," the court decision says.

The city ordinance prohibits public accommodations from discriminating against people of protected status -- which includes sexual orientation. But neither the state nor federal civil rights accommodation statutes "lists sexual orientation as a legally protected status," the decision says.

Both the owners are Christians and seek to operate their business "consistent with their religious beliefs," the court says.

"Duka and Koski's beliefs about same-sex marriage may seem old-fashioned, or even offensive to some," the court decision reads. "But the guarantees of free speech and freedom of religion are not only for those who are deemed sufficiently enlightened, advanced, or progressive. They are for everyone."

Read More