The announcement completed a turnabout for the president, who has opposed gay marriage throughout his career in national politics. In 1996, as a state Senate candidate, he indicated support for gay marriage in a questionnaire, but Obama aides later disavowed it and said it did not reflect the candidate's position.
In 2004, as a candidate for the U.S. Senate, he cited his own religion in framing his views.
"I'm a Christian," he said. "I do believe that tradition and my religious beliefs say that marriage is something sanctified between a man and a woman."
He maintained that position through his 2008 presidential campaign and through his term as president, until today.
As president in 2010, Obama told ABC News' Jake Tapper that his feelings about gay marriage were "constantly evolving. I struggle with this."
A year later, the president told ABC's George Stephanopoulos, "I'm still working on it."
"I probably won't make news right now, George," Obama said in October 2011. "But I think that there's no doubt that as I see friends, families, children of gay couples who are thriving, you know, that has an impact on how I think about these issues."
Obama's decision has political connotations for the fall. The issue divides elements of the Democratic base, with liberals and gay-rights groups eager to see the president go further, but with gay marriage far less popular among African-American voters.
Obama's likely Republican opponent, Mitt Romney, opposes gay marriage and fought his state's highest court, as governor, when Massachusetts became the first state to legalize gay marriage in 2004. Romney said on the campaign trail Monday that he continues to oppose gay marriage.
"My view is that marriage is a relationship between a man and a woman," Romney said. "That's the position I've had for some time, and I don't intend to make any adjustments at this point ... or ever, by the way."