LOS ANGELES, Sept. 7 -- Gov. Arnold Schwarzenegger (R) announced Wednesday night that he will veto landmark legislation that would have allowed same-sex couples to marry.

In a statement, Schwarzenegger's press secretary, Margita Thompson, said the governor opposes the legislation, passed Tuesday night by the California Assembly and last week by the state Senate, because he thinks the matter should be decided by California's courts or its voters.

Schwarzenegger's decision ends the prospects for the Religious Freedom and Civil Marriage Protection Act, which passed along strict party lines after an impassioned debate in the California Assembly. The measure would have recast the state's legal definition of marriage as a union between two people rather than a union between a man and a woman.

The vote marked the first time that a state legislature had approved a bill authorizing same-sex marriage without a court order. Massachusetts has passed regulations allowing gay marriage, but only after state courts ordered it to do so.

Gay rights advocates had hailed the Assembly's vote as a victory for civil rights and as a sign that California was again setting a trend for the nation to follow. Conservative activists said the law underscored the lax morality of modern society, and they predicted it would weaken families.

Critics accused Schwarzenegger of dodging an important issue and playing to his Republican conservative base. The onetime movie star's popularity has sagged to its lowest point since he rolled to power on the back of a recall vote in 2003.

"The guy has decided he'd rather shore his relationship with a minority right-wing base than to behave in a way that's more centrist," said Assemblywoman Jackie Goldberg (D-Los Angeles), one of six openly gay members of the state legislature. "But no right-wing base has ever elected a governor."

Schwarzenegger's spokeswoman defended the governor's position, saying he continues to back gay rights, including domestic partnership programs that grant same-sex couples most of the rights enjoyed by married couples. She noted that in 2000 California's voters expressed their views on the marriage issue, passing by more than 60 percent Proposition 22, which defined marriage as being between a man and a woman.

Schwarzenegger's move does not end California's fight over the bedroom -- it simply moves it back to the courthouse and potentially the ballot box.

Early last year, San Francisco officials declared that Proposition 22 violated the state's constitution and unilaterally issued marriage licenses to more than 4,000 gay couples. The state Supreme Court nullified those unions, citing the law. In March, a San Francisco judge hearing lawsuits from activists and city officials declared the law unconstitutional, setting the scene for a battle that will return to the state's highest court.

In addition, conservative activists are planning a proposition for a June 2006 election that would ban gay marriage. Another measure would severely curtail domestic partnership benefits.

A Field Poll released last week showed Californians to be split on the issue, with 46 percent opposing and 46 percent approving of same-sex marriages.

Special correspondent Joe Dignan in San Francisco contributed to this report.