Updated

A federal judge on Wednesday overturned a California ban on same-sex marriage, ruling that the Proposition 8 ballot initiative was unconstitutional, but a pending appeal of the landmark ruling could prevent gay weddings from resuming in the state any time soon.

The ruling by U.S. District Judge Vaugh Walker, one of three openly gay federal judges in the country, gave opponents of the controversial Proposition 8 ballot a major victory.

Gay couples waving rainbow and American flags outside the courthouse cheered, hugged and kissed as word of the ruling spread.

"Our courts are supposed to protect our Constitutional rights," lead plaintiff Kris Perry said as Sandy Stier, her partner of 10 years, stood at her side. "Today, they did."

Despite the favorable ruling for same-sex couples, gay marriage will not be allowed to resume. That's because the judge said he wants to decide whether his order should be suspended while the proponents pursue their appeal in the 9th U.S. Circuit Court of Appeals. The judge ordered both sides to submit written arguments by Aug. 6 on the issue.

Supporters argued the ban was necessary to safeguard the traditional understanding of marriage and to encourage responsible childbearing.

California voters passed the ban as Proposition 8 in November 2008, five months after the state Supreme Court legalized gay marriage.

"Proposition 8 fails to advance any rational basis in singling out gay men and lesbians for denial of a marriage license. Indeed, the evidence shows Proposition 8 does nothing more than enshrine in the California Constitution the notion that opposite-sex couples are superior to same-sex couples," the judge wrote in a 136-page ruling that laid out in precise detail why the ban does not pass constitutional muster.

The judge found that the gay marriage ban violates the Constitution's due process and equal protection clauses.

"Because Proposition 8 disadvantages gays and lesbians without any rational justification, Proposition 8 violates the Equal Protection Clause of the Fourteenth Amendment," the judge ruled.

Both sides previously said an appeal was certain if Walker did not rule in their favor. The case would go first to the 9th U.S. Circuit Court of Appeals, then the Supreme Court if the high court justices agree to review it.

"In America, we should uphold and respect the right of people to make policy changes through the democratic process, especially changes that do nothing more than uphold the definition of marriage that has existed since the founding of this country and beyond," said Jim Campbell, a lawyer on the defense team.

Walker heard 13 days of testimony and arguments since January during the first trial in federal court to examine if states can prohibit gays from getting married.

The verdict was the second in a federal gay marriage case to come down in recent weeks. A federal judge in Massachusetts decided last month the state's legally married gay couples had been wrongly denied the federal financial benefits of marriage because of a law preventing the U.S. government from recognizing same-sex unions.

The plaintiffs in the California case presented 18 witnesses. Academic experts testified about topics ranging from the fitness of gay parents and religious views on homosexuality to the historical meaning of marriage and the political influence of the gay rights movement.

Former U.S. Solicitor General Theodore Olson delivered the closing argument for opponents of the ban. He told Judge Walker that tradition or fears of harm to heterosexual unions were legally insufficient grounds to discriminate against gay couples.

Olson teamed up with David Boies to argue the case, bringing together the two litigators best known for representing George W. Bush and Al Gore in the disputed 2000 election.

Defense lawyers called just two witnesses, claiming they did not need to present expert testimony because U.S. Supreme Court precedent was on their side. The attorneys also said gay marriage was an experiment with unknown social consequences that should be left to voters to accept or reject.

Former U.S. Justice Department lawyer Charles Cooper, who represented the religious and conservative groups that sponsored the ban, said cultures around the world, previous courts and Congress all accepted the "common sense belief that children do best when they are raised by their own mother and father."

In an unusual move, the original defendants, California Attorney General Jerry Brown and Gov. Arnold Schwarzenegger, refused to support Proposition 8 in court.

That left the work of defending the law to Protect Marriage, the group that successfully sponsored the ballot measure that passed with 52 percent of the vote after the most expensive political campaign on a social issue in U.S. history.

Currently, same-sex couples can only legally wed in Massachusetts, Iowa, Connecticut, Vermont, New Hampshire and Washington, D.C.

The Associated Press contributed to this report.