Interviews with administration officials, however, suggest that the president believes he can stand pat and still win a large majority of gay votes, based on his track record, which includes his decision not to defend a 1996 law that defines marriage as a legal union between a man and a woman.

Image Secretary of State Hillary Rodham Clinton in Geneva. Credit... Anja Niedringhaus/Associated Press

The president may have history on his side: a nationwide exit poll conducted by the firm Edison/Mitofsky in the 2008 elections found that 4 percent of voters indicated they were gay. Of that group, 70 percent said they voted for Mr. Obama and 27 percent for the Republican nominee, Senator John McCain.

This time, Mr. Obama is being helped by Republican candidates who are competing to proclaim their opposition to same-sex marriage as they court social conservatives in Iowa. Former Gov. Mitt Romney of Massachusetts, former Speaker Newt Gingrich and Gov. Rick Perry of Texas have all been confronted in recent days over their positions on gay rights.

Mr. Gingrich told a voter in Iowa that he should “be for Obama” if same-sex marriage was the sole issue he cared about. Mr. Perry was heckled for a television commercial in which he declared, “There’s something wrong in this country if gays can serve openly in the military but our kids can’t openly celebrate Christmas.” Mr. Romney sat down with a military veteran in a New Hampshire restaurant and ended up sparring with him over the state’s gay-marriage law, which Mr. Romney opposes.

David B. Mixner, a longtime gay rights advocate who has raised money for candidates, said he planned to work hard for Mr. Obama’s re-election. “We can keep pushing for marriage without stopping our work for him,” he said, “because we can just look at the cast of characters waiting in the wings.”

Mr. Obama’s appeal to supporters of gay rights rests on more than a fear of Republicans. Administration officials say he has compiled an impressive record, same-sex marriage aside. In particular, the repeal of the “don’t ask, don’t tell” policy that prohibited gay men, lesbians and bisexuals from serving openly in the military fulfilled a campaign promise that many supporters did not believe Mr. Obama would be able to keep.