The city will appeal a judge's ruling against the state ban on same-sex marriages (search), the mayor said Saturday.

Mayor Michael Bloomberg (search) said he wanted the issue to be settled in the state's highest court or in the Legislature.

"If we did not appeal this, I think we would have chaos in this city," said Bloomberg, who said he supports allowing same-sex marriage.

State Supreme Court Justice Doris Ling-Cohan (search) ruled Friday that the state ban is unconstitutional, finding in favor of five same-sex couples who had been denied marriage licenses by the city. The judge said the city clerk may not deny a license solely because a couple are of the same sex.

The mayor said he wanted to avoid "a repetition of California, when many people for a month were misled into thinking they could get the union they so much wanted," referring to same-sex marriages performed last year in San Francisco that were later invalidated.

"I'm glad the judge ruled this way because it gets us the ability to get this to the appellate court," Bloomberg said.

The ruling, the first of its kind in New York, would clear the way for gay couples to wed if it survives on appeal. It applies only in the city but could extend statewide if upheld by the Court of Appeals in Albany.