"My view is that marriage itself is a relationship between a man and a woman, and that's my own preference," he told reporters Wednesday. "I know other people have differing views. This is a very tender and sensitive topic, as are many social issues."
For months, the president's advisors gave no indication that he planned to reveal a new stance before the November election, believing that Obama's record on other gay rights issues would suffice to win over an increasingly powerful network of gay donors and other ardent supporters. Obama ended the "don't ask, don't tell" policy barring gay soldiers from serving openly and dropped the legal defense of the Defense of Marriage Act.
But advisors say the president decided a few weeks ago that he had changed his mind and wanted to make an announcement before the Democratic National Convention in September.
Michelle Obama was a strong influence, administration officials said. She went out of her way to invite gay, lesbian, bisexual and transgender couples to events she sponsored for military families.
Several gay staffers work in the West Wing and at least one pair are in a committed relationship and raising children. The Obama daughters also have friends with same-sex parents, whom the first family has gotten to know.
"He was ready," said a second senior administration official.
Biden's comments pushed up the timing. The "evolving" stance threatened to undermine not only the president's standing on gay issues but also his credibility. The president's foot-dragging on an issue important to his base undoubtedly clashed with his new campaign slogan, "Forward."
Obama's announcement was celebrated by gay rights activists and Democratic allies.
"The president's words will no doubt inspire thousands more conversations around kitchen tables and in church pews," said Human Right Campaign President Joe Solmonese. "We are confident that our nation will continue to move inexorably toward equality."
Obama's new position is also a marker in his party's evolution and solidifies, for now, a clear partisan divide on gay rights. For more than a decade, leading Republicans and Democrats had opposed same-sex marriage. Obama has taken multiple stances on the issue. In 1996, as a candidate for the state Senate in Illinois, he told a gay rights group that he favored same-sex marriages and would fight efforts to block them. As a candidate for the Senate in 2004, Obama said he believed marriage is between a man and a woman, citing his faith as the reason for that belief.
In 2008, he repeated that assertion to influential evangelical pastor Rick Warren, adding: "For me as a Christian it's also a sacred union. God's in the mix." But Obama also said he would not support an amendment to put that definition in the Constitution.
Defining marriage "has been a matter of state law. That has been our tradition," he said. At the same time, Obama opposed a California ballot initiative outlawing same-sex marriage because it was "divisive and discriminatory."
Obama had plenty of company in such murky waters. But since then, Obama's party has steadily moved toward support for gay marriage.
L.A. Mayor Antonio Villaraigosa, who is the chairman of the party's convention, was among the first to call on Democrats to add support for same-sex marriage to the party platform. Obama's announcement probably heads off an awkward battle over that issue at the convention.
Time staff writers Michael Finnegan, Matea Gold, Michael A. Memoli, Joseph Tanfani and Paul West contributed to this report.