SACRAMENTO  Less than two weeks before Election Day, the chief strategist behind a ballot measure outlawing same-sex marriage in California called an emergency meeting here.

“We’re going to lose this campaign if we don’t get more money,” the strategist, Frank Schubert, recalled telling leaders of Protect Marriage, the main group behind the ban.

The campaign issued an urgent appeal, and in a matter of days, it raised more than $5 million, including a $1 million donation from Alan C. Ashton, the grandson of a former president of the Mormon Church. The money allowed the drive to intensify a sharp-elbowed advertising campaign, and support for the measure was catapulted ahead; it ultimately won with 52 percent of the vote.

As proponents of same-sex marriage across the country planned protests on Saturday against the ban, interviews with the main forces behind the ballot measure showed how close its backers believe it came to defeat  and the extraordinary role Mormons played in helping to pass it with money, institutional support and dedicated volunteers.