Baker Jack Phillips, right, owner of Masterpiece Cakeshop, hugs an unidentified man in Lakewood, Colorado after the US Supreme Court ruled that he could refuse to make a wedding cake for a same-sex couple because his religious beliefs did not violate Colorado's anti-discrimination law. File picture: David Zalubowski/AP

New York - It's the icing on the cake.

The Colorado baker whose refusal to bake a wedding cake for a gay couple was partially upheld by the Supreme Court has ended a separate legal spat with the state over his refusal to make a cake for a transgender woman.

Colorado Attorney General Phil Weiser and baker Jack Phillips's legal team agreed to end two cases: one brought against Phillips by the state for refusing to make a cake celebrating a gender transition and a federal lawsuit against the state that Phillips filed claiming the state was on a "crusade to crush" him.

Weiser, a Democrat, said both sides "agreed it was not in anyone's best interest to move forward with these cases." Phillips's legal team called it a win for their client.

Autumn Scardina, the Denver attorney who filed her complaint with the Colorado Civil Rights Commission against Masterpiece Cakeshop in the Denver suburbs, was free to pursue her own legal action against Phillips, the attorney general said.

Scardina filed her complaint after Phillips refused to bake her a cake that was blue on the outside and pink on the inside, symbolizing her transition from male to female.

Phillips, in early court filings in the case, claimed that he believed gender "is given by God ... and cannot be chosen or changed."

"We hope that the state is done going along with obvious efforts to harass Jack," said Jim Campbell, an attorney for the Alliance Defending Freedom. "He shouldn't be driven out of business just because some people disagree with his religious beliefs and his desire to live consistently with them."

"The larger constitutional issues might well be decided down the road, but these cases will not be the vehicle for resolving them," Weiser said in a statement. "Equal justice for all will continue to be a core value that we will uphold as we enforce our state's and nation's civil rights laws."

There was no timetable for Scardina to pursue legal action, should she choose to do so.

tca/dpa