California's Supreme Court cleared the way on Thursday for supporters of the state's same-sex marriage ban to defend it in federal court, a crucial ruling that allows the pitched battle to decide if gay marriage is a U.S. right to go forward.

The case on California's 2008 ban, the voter initiative known as Proposition 8, could set national policy if the U.S. Supreme Court takes it up, and the high court might agree as early as next year to hear it, one lawyer said.

More than 40 U.S. states have outlawed same-sex marriages, and polls show sharp national division on the matter.

The voter-approved ban in the most populous U.S. state has been in legal limbo over a technical issue: whether citizens can defend a ballot initiative when elected officials choose not to.

The state's top court unanimously said they could.

Gay rights attorneys said the ruling would help get a federal appeals court back to the main issue -- whether gay marriage is a constitutional right.

Both sides made their cases on that core issue a year ago to the 9th U.S. Circuit Court of Appeals.

We are very hopeful for a relatively prompt 9th Circuit decision vindicating the rights of gays and lesbians under the U.S. Constitution, attorney Ted Olson, fighting for gay marriage, told reporters on a conference call after the ruling.

Proponents of the ban said gay rights attorneys had nothing to celebrate.

Their entire legal strategy relied on this case ending in the 9th Circuit, and that strategy has basically crumbled before their eyes, clearing the path ultimately to the U.S. Supreme Court, where we think we will prevail, said Andrew Pugno, a lawyer defending the Prop 8 ban.

OFFICIALS HAD DECLINED

A U.S. district court ruled last year that Prop 8 was unconstitutional, setting up the current appeals fight.

But former California Governor Arnold Schwarzenegger and former state Attorney General Jerry Brown, now the current governor, declined to defend the ban.

The case could have died if proponents of the ban were not allowed into court. Now backers of a ballot initiative can defend it if state officials choose not to.

The core case began when Olson and David Boies, who argued against each other in the U.S. Supreme Court case that put President George W. Bush in office, joined forces to take on the California ban.

Both sides have already argued on appeal about the constitutionality of gay marriage. Proponents of such unions say marriage is a fundamental right for everyone, while opponents say voters in California have the right to limit the institution to opposite-sex couples.

Another challenge could hold up the case, this one concerning the district judge who ruled that gay marriage was a right. Now-retired U.S. District Chief Judge Vaughn Walker is gay, and backers of the ban want his decision thrown out because they say he was compromised.

That matter is before the same federal appeals panel, after another district judge said Walker was unbiased.

The Supreme Court could decide by June or October whether to take the case, Olson said. Pugno agreed that scenario was possible but said that history in the case suggested more twists and turns.

Nothing about this case has been predictable, he said.