A Colorado baker who refused to make a wedding cake for a gay couple on religious grounds — a stance partially upheld by the U.S. Supreme Court — and state officials said Tuesday that they would end a separate legal fight over his refusal to bake a cake celebrating a gender transition.

Colorado Attorney General Phil Weiser and attorneys representing Jack Phillips said they mutually agreed to end two legal actions, including a federal lawsuit Phillips filed accusing the state of waging a "crusade to crush" him by pursuing a civil rights complaint over the gender transition cake.

Phillips' attorneys dubbed the agreement a victory for the baker. Weiser, a Democrat, said both sides "agreed it was not in anyone's best interest to move forward with these cases."

The agreement resolves every ongoing legal dispute between the owner of Masterpiece Cakeshop in suburban Denver and the state. Weiser's statement said it has no effect on the ability of the Denver attorney who filed a complaint with the Colorado Civil Rights Commission to pursue her own legal action.

The attorney, Autumn Scardina, told the commission that Phillips refused last year to make a cake that was blue on the outside and pink on the inside for a celebration of her transition from male to female.

She asked for the cake on the same day the U.S. Supreme Court announced it would consider Phillips' appeal of a previous commission ruling against him. In that 2012 case, he refused to make a wedding cake for same-sex couple Charlie Craig and Dave Mullins.

The U.S. Supreme Court ruled in July that the commission showed anti-religious bias when it sanctioned Phillips. The justices did not rule on the larger issue of whether businesses can invoke religious objections to refuse service to gays or lesbians.

Weeks later, the commission found probable cause that Phillips had discriminated against Scardina because she is transgender and ordered them to find a solution through mediation. Phillips then filed a federal lawsuit against the commission, citing his belief that gender "is given by God ... and cannot be chosen or changed."

Both sides notified a federal judge on Tuesday that Phillips' lawsuit was being dropped and each party would pay for their own costs and attorney fees.

"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 conservative Christian nonprofit law firm represented Phillips in the U.S. Supreme Court case and the latest dispute.

Weiser said the commission unanimously voted to dismiss its administrative action against Phillips.

"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."

It wasn't immediately known if Scardina, the Denver attorney, planned further action involving Phillips. Telephone messages for Autumn Scardina and for Todd Scardina, an attorney representing Autumn in the civil rights commission proceedings, weren't immediately returned Tuesday.

___

Associated Press writers James Anderson and Colleen Slevin contributed to this report.