Barack Obama became the first US president to say publicly he was in favor of same-sex marriage, in a high-stakes intervention in a pre-election debate roiling American politics.
In what supporters will hail as a historic moment in civil rights history, Obama changed his stance, after previously saying he was "evolving" on gay marriage, a fiercely divisive issue in US politics.
"I've just concluded, 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," Obama said in an interview with ABC News.
The president said however that a decision on whether to legalize gay marriage should be left to individual states. He also talked about how he and his wife Michelle had squared his decision with their faith.
"We are both practicing Christians and obviously this position may be considered to put us at odds with the views of others," he said.
"But it's also the Golden Rule, you know -- treat others the way you would want to be treated."
Obama, who previously backed strong protections for gay and lesbian couples but not full marriage, said his position had evolved after talking to his two daughters Malia and Sasha who had friends who had same-sex parents.
"It wouldn't dawn on them that somehow their friends' parents would be treated differently. It doesn't make sense to them and frankly, that's the kind of thing that prompts a change in perspective," Obama said in the interview.
Obama came under increasing political pressure on gay marriage after Vice President Joe Biden said on NBC's Meet the Press on Sunday that he was "absolutely comfortable" with same-sex marriage.
Some political analysts have warned that Obama could be entering a political minefield, with some key voting blocs in swing states that he hopes to court in November's election opposing gay marriage.
On Tuesday, voters in North Carolina, a state Obama narrowly carried in the 2008 election, approved a state constitutional amendment forbidding gay marriages, civil unions and domestic partnerships.
The measure was passed by 61 percent to 39 percent after similar state constitutional amendments had been approved in some 30 US states.
The amendment solidifies and expands already enacted North Carolina law forbidding same-sex marriage.
Religious conservatives condemned Obama for his move, which will set up an interesting bout with Republican White House hopeful Mitt Romney for the affections of independent voters on the issue.
Romney said on Wednesday he did not "favor marriage between people of the same gender," and also opposed civil unions.
Republican strategists have in the past used gay marriage as a "wedge issue" to inject cultural issues into narrow elections in swing states.
But there are signs that broader public opinion on gay marriage is moderating, though conservative groups are redoubling efforts to thwart the pro-gay lobby, seeking constitutional bans on gay marriage.
In a Gallup poll conducted between May 3 and 6, 50 percent of Americans said they backed gay marriage, while 48 percent said it should not be legalized.
Gay rights supporters praised Obama for his move, which may have the potential to fire up his political base, which had been less excited about his reelection bid than it was about his first candidacy four years ago.
"President Obama made history by boldly stating that gay and lesbian Americans should be fully and equally part of the fabric of American society," said Joe Solmonese of the Human Rights Campaign.
"His presidency has shown that our nation can move beyond its shameful history of discrimination and injustice.
"President Obama extends that message of hope to a generation of young lesbian, gay, bisexual and transgender Americans, helping them understand that they too can be who they are and flourish as part of the American community."
New York Mayor Michael Bloomberg also praised Obama's move.
"This is a major turning point in the history of American civil rights," Bloomberg said.
"No American president has ever supported a major expansion of civil rights that has not ultimately been adopted by the American people -- and I have no doubt that this will be no exception."
But reaction against Obama's comments were just as plentiful.
Cardinal Timothy Dolan, the president of the US Conference of Catholic Bishops, called Obama's comments "deeply saddening," while some conservative groups said the incumbent had compromised any chance he had at re-election.
"President Obama stuck a fork in himself today. He's done. He's toast," said Bryan Fischer of the American Family Association. "What God has defined, man may not redefine."