SAN FRANCISCO  In a sharp rebuke to supporters of a contested state ballot measure that banned same-sex marriage, the California attorney general said Friday that the measure was constitutionally indefensible and should be overturned.

The attorney general, Jerry Brown, had previously hinted of his opposition to the measure, Proposition 8, but made his legal opinion concrete on Friday in a brief to the California Supreme Court, which is reviewing the measure. “Proposition 8 must be invalidated because the amendment process cannot be used to extinguish fundamental constitutional rights without compelling justification,” Mr. Brown said in a statement.

Opponents have argued that the proposition fundamentally altered the state Constitution by taking away the right to marry from same-sex couples, who had been free to do so since May, when the California Supreme Court legalized such marriages. Proposition 8 overturned that decision by defining marriage in California as between only men and women.

Supporters of Proposition 8 asked the court in a separate legal brief filed Friday to invalidate the approximately 18,000 same-sex weddings performed before the ban was passed.