California's ruling is expected to have an impact on the nationwide debate
California's top court has ruled that a state law banning marriage between same-sex couples is unconstitutional.
The state's Supreme Court said the "right to form a family relationship" applied to all Californians regardless of sexuality.
The ban was approved by voters in 2000 but challenged by gay rights activists and the city of San Francisco.
The state legislature twice passed laws to legalise gay marriage, but Governor Arnold Schwarzenegger vetoed them.
He said California's court system should rule on the matter.
The seven-judge panel voted 4-3 in favour of the plaintiffs who argued that the 2000 law was discriminatory.
"Limiting the designation of marriage to a union 'between a man and a woman' is unconstitutional and must be stricken from the statute," California Chief Justice Ron George said in the written opinion.
The decision was met outside the courthouse by cheers from gay marriage supporters.
"I'm profoundly grateful. This is a historic day," said San Francisco City Attorney Dennis Herrera, who argued the city's case to the court.
"Everybody being entitled to equal protection under the law probably carried the day," he said.
The ruling paves the way for California to become only the second US state, after Massachusetts, to allow same-sex marriage.
The decision is expected to re-invigorate the fight for same-sex marriage rights nationwide, say gay activists and legal experts.
California's Supreme Court has a history of landmark rulings that are later picked nationally.
The state currently offers same-sex couples who register as domestic partners the same legal rights and responsibilities as married men and women.
Other states, such as Vermont and New Jersey, have similar civil union provisions.
Californian voters approved the ban against same-sex marriages in a 2000 referendum. The law stated that "only marriage between a man and a woman is valid or recognised in California".
In early 2004, San Francisco became the first place in the US where gay couples were able to marry after the city's Mayor Gavin Newsom authorised same-sex marriage licences, claiming the state legislation was discriminatory.
In August of that year, California's Supreme Court ruled the mayor had overstepped his authority and nullified the hundreds of marriages.
Gay rights group Equality California was joined by nearly two dozen gay couples and the city of San Francisco in bringing the case to the Supreme Court.