In a letter to Alice B. Toklas LGBT Democratic Club read Sunday at the group’s annual Pride Breakfast in San Francisco, the Illinois senator said he supports extending “fully equal rights and benefits to same-sex couples under both state and federal law.”

“And that is why I oppose the divisive and discriminatory efforts to amend the California Constitution, and similar efforts to amend the U.S. Constitution or those of other states,” Obama wrote.

Obama had previously said he personally opposes same-sex marriage, but each state should make its own decision.

A spokesman for Republican presidential candidate John McCain, who last week endorsed Proposition 8 on the Nov. 4 California ballot, accused Obama of continuing a pattern of changing his position on issues.

“It just depends on where you catch him and what time of day … whether it’s public financing, town hall debates and now gay marriage,” said Rick Gorka, a spokesman for the Arizona senator.

Senator Obama has gone from “it’s a state issue” to undoing the federal protection of the states’ ability to define marriage to now actively putting his campaign for president in favor of gay marriage in California. Way to reach out to those swing voters in Wisconsin, Ohio, North Carolina and Virginia.