San Francisco has asked a federal judge to overturn California's ban on same-sex marriage, allying the city with a lawsuit that could reach the U.S. Supreme Court.

In papers filed Thursday night in U.S. District Court in San Francisco, City Attorney Dennis Herrera's office argued that Proposition 8 was motivated by hatred of gays and lesbians and violates their constitutional right to be free of discrimination.

Although sponsors of the November ballot measure said they were trying to promote traditional marriage and protect children, "excluding same-sex couples from marriage does nothing to advance those goals," Chief Deputy City Attorney Therese Stewart said in the 49-page brief.

In arguing to throw out Prop. 8, Stewart cited the Supreme Court's 1996 ruling that struck down Colorado's ban on state and local gay-rights measures and said a law motivated by hostility toward gays and lesbians is unconstitutional.

A year after ruling that same-sex couples had the right to marry, the state Supreme Court upheld Prop. 8 last month, ruling 6-1 that voters could amend the California Constitution to define marriage as the union of a man and a woman. Four days before that ruling, two same-sex couples represented by Theodore Olson and David Boies, attorneys for opposing sides in the 2000 Bush vs. Gore presidential election case, challenged Prop. 8 in federal court.

The suit claimed the measure violated equal protection rights under the U.S. Constitution. Gay-rights groups that challenged Prop. 8 in the state court had avoided making any federal constitutional arguments to keep the case away from the conservative U.S. Supreme Court, where a ruling upholding the law would set a nationwide precedent against same-sex marriage.

San Francisco, which also took part in the state Supreme Court case against Prop. 8, has become the first of the state court plaintiffs to file in support of the federal court suit. Shannon Minter, legal director of the National Center for Lesbian Rights and lawyer for same-sex couples in the state court case, said Friday that his organization may take the same step.

The federal suit is "going forward, and we certainly want it to succeed," Minter said.