The Iowa Supreme Court, citing California's historic marriage decision, overturned a ban Friday on same-sex marriage in a ruling that emphasized the need for courts to protect minorities even when public sentiment is against them.

The unanimous decision makes Iowa the first Midwestern state to legalize gay marriage, which is also permitted in Massachusetts and Connecticut.

The decision came as the California Supreme Court considers whether to overturn Proposition 8, the November ballot measure that banned gay marriages after the court's groundbreaking ruling May 15 that allowed them.

Gay rights activists and a legal scholar said Friday's ruling could provide ammunition for overturning Proposition 8, either in court or at the ballot box. During a hearing last month, a majority of the California court appeared ready to uphold the ballot measure.

In the Iowa decision, Justice Mark Cady wrote: "We are firmly convinced the exclusion of gay and lesbian people from the institution of civil marriage does not substantially further any important governmental objective. The Legislature has excluded a historically disfavored class of persons from a supremely important civil institution without a constitutionally sufficient justification."

Gay rights advocates were jubilant.

"It's a red-letter day for us here in Iowa," said Matt McCoy, a gay member of the state Senate who cheered the decision from the courthouse steps in Des Moines.

Foes vowed to fight it. Bryan English, spokesman for the Iowa Family Policy Center, said the decision was like "a death in the family."

Following a few minutes of mourning on the courthouse steps after the decision was handed down, English said, he and other opponents walked across the street to the Legislature's offices and began lobbying lawmakers for a constitutional amendment to ban same-sex marriage.

That would not be as easy as it was in California.

Lawmakers in the Democrat-controlled Legislature must first vote for an amendment in two consecutive sessions. Only then can a measure go on the ballot, where voters can approve it with a simple majority.

In California, Proposition 8, which voters approved by 52% to 48%, reached the ballot through a signature drive.

On the other hand, a ballot fight in Iowa, which has just 3 million people, would cost significantly less than the more than $70 million total spent by both sides in California.

Legal experts said the Iowa ruling, written by one of the two Republican appointees on the seven-member court, was striking in that it was the first unanimous decision backing same-sex marriage rights. Such decisions by the Connecticut, California and Massachusetts high courts were all split.

USC constitutional law professor David B. Cruz said the ruling could influence the California Supreme Court's decision on Prop. 8 "if there are justices who are still wavering one way or another."

"It shows them that a Republican appointee writing for a unanimous court in a not decidedly liberal state takes the view that there are basic constitutional guarantees that are especially important for the judiciary to enforce," Cruz said.

Iowa has long had a progressive streak. Its public schools were integrated nearly a century before 1954's Brown vs. the Board of Education of Topeka, and in 1869 it became the first to admit women to its state bar.

Iowa's ruling appeared to be "a response" to the kind of criticism the California Supreme Court received when a majority voted May 15 to end the marriage ban, Cruz said.

"The opinion is very, very careful to lay out its understanding of the role of the judiciary at some length and to defend that role," Cruz said, adding that the ruling dealt heavily with "the importance of an independent judiciary enforcing constitutional rights even if they might be unpopular with a large majority."