Patrons at Hartigan's Irish Pub in Charlotte, N.C., watched as President Obama discussed same-sex marriage on ABC. WASHINGTON - Before President Obama left the White House on Tuesday morning to fly to an event in Albany, several aides intercepted him in the Oval Office. Within minutes it was decided: the president would endorse same-sex marriage on Wednesday, completing a wrenching personal transformation on the issue. As described by several aides, that quick decision and his subsequent announcement in a hastily scheduled network television interview were thrust on the White House by 48 hours of frenzied will-he-or-won't-he speculation after Vice President Joseph R. Biden Jr. all but forced the president's hand by embracing the idea of same-sex unions in a Sunday talk show interview. Advisers say now that Mr. Obama had intended since early this year to define his position sometime before Democrats nominate him for re-election in September. Yet many of the president's allies believed he would not do so, trusting instead in his strong support from gay voters for having ended a ban on openly gay people in the military and disavowing a federal law defining marriage as between a man and a woman. Such caution was understandable, the allies said, given the unpredictable fallout the president would face by taking a clear stand on one of the most contentious and politically charged social issues of the day, before what is likely to be a close election. Mr. Obama's closest advisers say only the timing was in question. Mr. Biden's unexpected remarks undoubtedly accelerated the timetable. Initially Mr. Obama and his aides expected that the moment would be Monday, when the president was scheduled to be on "The View," the ABC daytime talk show, which is popular with women. Certainly, they thought, he would be asked his position on same-sex marriage by one of the show's hosts, who include Barbara Walters and Whoopi Goldberg. Yet the pressure had become too great to wait until then, his aides told him; on Monday, the White House press secretary, Jay Carney, was pummeled with questions from skeptical reporters about Mr. Obama's stance. After the Tuesday morning meeting, Dan Pfeiffer, the president's communications director, contacted ABC and offered a wide-ranging interview with the president for the following day. And so it was that Mr. Obama on Wednesday afternoon sat down in the White House with ABC's Robin Roberts and made news, after nearly two years of saying that his views on same-sex marriage were "evolving." "At a certain point, I've just concluded that for me personally it is important for me to go ahead and affirm that I think same-sex couples should be able to get married," Mr. Obama said. Mr. Obama also invoked his Christian faith in explaining his decision. And I think that's what we try to impart to our kids, and that's what motivates me as president. Reaction to Mr. Obama's announcement was largely predictable - including immediate opposition from his presumptive Republican rival, Mitt Romney - yet people on both sides of the issue pointed to the historical significance of a president endorsing marriage between people of the same sex. It was a Democrat, Bill Clinton, who signed the Defense of Marriage Act, defining marriage as between a man and a woman, which the Obama administration last year decided not to enforce in the courts. While Mr. Obama's announcement was significant from a symbolic standpoint, more important as a practical matter were Mr. Obama's decision not to enforce the marriage act and his successful push in 2010 to repeal the "don't ask, don't tell" law that prohibited openly gay men and lesbians from serving in the military. For that reason, gay rights groups had been largely enthusiastic about his re-election campaign while being pragmatically resigned to his not publicly supporting same-sex marriage before the election. Mr. Obama's announcement has little substantive impact - as an aide said, "It's not like we're trying to pass legislation." Jeff Zeleny contributed reporting. An article on Thursday about President Obama's decision to declare his support for same-sex marriage described incorrectly in some editions a transcript circulated within the White House of Vice President Joseph R. Biden Jr."s earlier remarks on the subject. The transcript, of a taping on Friday for broadcast on NBC's "Meet the Press" on Sunday, had the vice president's remarks on gay marriage highlighted in yellow. It was not the case, as a White House official said, that the vice president's office did not call the comments to anyone's attention.