SAN FRANCISCO  A giant rainbow-colored flag in the gay-friendly Castro neighborhood of San Francisco was flying at half-staff on Wednesday as social and religious conservatives celebrated the passage of measures that ban same-sex marriage in California, Florida and Arizona.

In California, where same-sex marriage had been performed since June, the ban had more than 52 percent of the vote, according to figures by the secretary of state, and was projected to win by several Californian news media outlets. Opponents of same-sex marriage won by even bigger margins in Arizona and Florida. Just two years ago, Arizona rejected a similar ban.

The across-the-board sweep, coupled with passage of a measure in Arkansas intended to bar gay men and lesbians from adopting children, was a stunning victory for religious conservatives, who had little else to celebrate on an Election Day that saw Senator John McCain lose and other ballot measures, like efforts to restrict abortion in South Dakota, California and Colorado, rejected.

“It was a great victory,” said the Rev. James Garlow, senior pastor of Skyline Church in San Diego County and a leader of the campaign to pass the California measure, Proposition 8. “We saw the people just rise up.”