PHOENIX — The Arizona Supreme Court ruled Monday that a Phoenix business can refuse service to same-sex couples, overruling the city’s anti-discrimination ordinance.

The artists who operate Brush & Nib, which makes invitations and other wedding-related items, argued in a 2016 lawsuit that the ordinance violated their religious beliefs by forcing them to custom-make products for same-sex marriage ceremonies.

The court, voting 4-3, ruled that the rights to free speech and free exercise of religion include “the right to create and sell words, paintings, and art that express a person’s sincere religious beliefs.

“With these fundamental principles in mind, today we hold that the City of Phoenix (the “City”) cannot apply its Human Relations Ordinance (the “Ordinance”) to force Joanna Duka and Breanna Koski, owners of Brush & Nib Studios, LC (“Brush & Nib”), to create custom wedding invitations celebrating same-sex wedding ceremonies in violation of their sincerely held religious beliefs,” Justice Andrew Gould wrote in the opinion.

Gould wrote that the city’s anti-discrimination ordinance violates the state’s constitution in this case.

“To conclude, we hold that the Ordinance, as applied to Plaintiffs’ custom wedding invitations, and the creation of those invitations, unconstitutionally compels speech in violation of the Arizona

Constitution’s free speech clause,” he wrote.

He specified that the opinion was not necessarily meant to apply to situations outside of the Brush & Nib case.

“The City’s concern that our decision will undermine the anti-discrimination purpose of the Ordinance, or that it will encourage other businesses to use free speech as a pretext to discriminate against protected groups, is unwarranted,” Gould said.

“Our holding today is limited to Plaintiffs’ creation of one product: custom wedding invitations that are materially similar to the invitations contained in the record.”

The city further clarified that the ordinance is “still a legal, valid law and remains in effect.”

Justices John Lopez and John Pelander joined Gould in the opinion. Justice Clint Bolick filed a concurring opinion, while Justices Ann Timmer and Scott Bales and Judge Christopher Staring dissented.

Staring was sitting in for Chief Justice Robert Brutinel, who recused himself from the case.

Pelander and Bales worked on the case to its conclusion despite both having retired earlier this year. The justices who replaced them, James Beene and Bill Montgomery, were not part of the vote.

“Our constitutions and laws do not entitle a business to discriminate among customers based on its owners’ disapproval of certain groups, even if that disapproval is based on sincerely held religious beliefs,” Bales wrote in the dissenting opinion.

Two courts previously upheld the constitutionality of the ordinance and rejected the arguments made by the artists.

The Arizona Court of Appeals previously ruled that while the ordinance may have an incidental effect on free speech, its main purpose is to prohibit discrimination.

The appeals court concluded the ordinance regulates conduct, not speech.

The penalty for violating the ordinance would have been up to six months in jail and a $2,500 fine.

The Associated Press contributed to this report.

Follow @KTAR923