President Obama became the first U.S. president to endorse same-sex marriage today, telling ABC News that it "should be legal."

"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," Obama told ABC's Good Morning America.

After years of what he had called an "evolving" view of the issues, Obama said family and friends gradually persuaded him that gay and lesbian couples should be treated the same as heterosexual ones.

Facing a re-election bid in which gay rights are a hot button issue, Obama also said his endorsement is a personal view, and that states should set their own marriage laws. The interview took place a day after voters in North Carolina approved a constitutional ban on gay marriage.

His comments also came within a few days of pro-gay marriage statements by Vice President Biden and Education Secretary Arne Duncan, increasing pressure on Obama from gay rights supporters.

ABC News broke into regular programming to report Obama's comments.

Mitt Romney, Obama's likely opponent in the Nov. 6 election, told a Denver television station he doesn't agree with Obama's assessment of gay marriage.

"When these issues were raised in my state of Massachusetts I indicated my view which is I do not favor marriage between people of the same gender and I don't favor civil unions if they are identical to marriage other than by name," the former governor said. "My view is that domestic partnership benefits, hospital visitation rights and the like are appropriate but the others are not."

Aides said Obama intended to make the announcement before the Democratic convention in early September. But the intense media scrutiny given to the comments by Biden and Duncan pushed up the timetable.

They also said the gay marriage issue would not be a major part of their campaign, and do not know how or if it will affect the outcome of the election.

That said, the Obama re-election team posted video of the ABC interview on its campaign website.

Gay rights organization praised the president's announcement. The Human Rights Campaign, which has long lobbied Obama to take such a step, said Obama "made history by boldly stating that gay and lesbian Americans should be fully and equally part of the fabric of American society."

HRC President Joe Solmonese said Obama's "words will no doubt inspire thousands more conversations around kitchen tables and in church pews," promoting equality for gay couples.

The Family Research Council, a conservative group, called Obama's decision disappointing, but not surprising. FRC President Tony Perkins predicted that the president would suffer for it at the ballot box.

"As demonstrated by yesterday's overwhelming vote in North Carolina, redefining marriage remains outside the mainstream of American politics," Perkins said. "Especially in the critical battleground states and among minority voters."

Perkins said said that 10 of 16 battleground states that have "marriage amendments" could be at risk after Obama's announcement. "Today's announcement almost ensures that marriage will again be a major issue in the presidential election," Perkins said.

Once an opponent of gay marriage, Obama said he changed his views in part because of the "incredibly committed monogamous relationships, same-sex relationships" he has seen among friends and staff.

Obama said his views also changed as he worked to end the military ban on openly gay servicemembers, the former policy known as "don't ask, don't tell."

Views of gay marriage also tend to be "generational," Obama said, telling Robin Roberts of ABC that most young people he has met -- even very conservative Republicans in college -- tend to be more accepting of same-sex couples.

Obama said daughters Malia and Sasha believe discrimination against gay marriage "doesn't make sense to them and frankly, that's the kind of thing that prompts a change in perspective."

First lady Michelle Obama has also shaped his outlook, Obama said.

"This is something that, you know, we've talked about over the years and she, you know, she feels the same way, she feels the same way that I do," Obama said.

The president said he and Mrs. Obama "are both practicing Christians and obviously this position may be considered to put us at odds with the views of others."

"But, you know, when we think about our faith, the thing at root that we think about is, not only Christ sacrificing himself on our behalf," he added, "but it's also the Golden Rule, you know, treat others the way you would want to be treated."

Obama's decision is drawing a variety of strong reactions on social media.

ABC News, meanwhile, prepared a handy "timeline" of Obama statements on gay marriage: