Media playback is unsupported on your device Media caption Obama: "Same sex couples should be able to get married"

US President Barack Obama has ended months of hedging on the issue of gay marriage by saying he thinks same-sex couples should be able to wed.

He has become the first sitting US president to back gay marriage.

Mitt Romney, the Republican who is set to challenge Mr Obama for the White House in November's elections, promptly said he was against gay marriage.

In recent days, Vice-President Joe Biden and cabinet member Arne Duncan had expressed support for gay unions.

A Gallup poll on Tuesday suggested that 50% of Americans were in favour of legalising gay marriage - a slightly lower proportion than last year - while 48% said they would oppose such a move.

Analysis President Barack Obama has been forced out of the closet. Few doubted that he was in favour of gay marriage but "don't ask, don't tell" had worked well enough up until now. The media didn't ask him. And he certainly wasn't going to tell. I am told his campaign staff really thought they could get away with not touching this hot button issue, and go through until election night leaving his views draped with hazy protestations about the ongoing "evolution" of his views. I have trouble believing that they thought he could avoid the question until November. But there is no doubt that the rapid evolution of his views into the limelight was not intelligent design. Unless you see Vice-President Joe Biden as the creator of presidential frankness. Hope and change?

The interview with ABC News was apparently hastily arranged as Mr Obama came under mounting pressure to clarify his position on the issue.

"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 told ABC.

He pointed to his administration's commitment to increasing rights for gay citizens. He cited the repeal of the military's "don't ask, don't tell" policy and said his administration had dropped support for the Defense of Marriage Act.

"I've stood on the side of broader equality for the LGBT community. I hesitated on gay marriage in part because I thought civil unions would be sufficient," Mr Obama said.

He said he had changed his views after seeing gay members of his own staff who were in "incredibly committed monogamous relationships", and service personnel who felt constrained by not being able to wed.

Mr Obama also said discussions with his own family had helped the "evolution" of his views on the issue.

Media playback is unsupported on your device Media caption Romney: Position on marriage is the same position I had as governor

"There have been times where Michelle and I have been sitting around the dinner table and... Malia and Sasha, it wouldn't dawn on them that somehow their friends' parents would be treated differently," Mr Obama said.

"It doesn't make sense to them and frankly, that's the kind of thing that prompts a change in perspective."

In 2010, Mr Obama said his views on the issue were "evolving", a stance that had frustrated gay rights supporters and donors.

His comments aired on Wednesday come a day after North Carolina approved a constitutional amendment effectively banning same-sex marriage or civil unions.

US gay marriage laws Same-sex marriage has been passed in New York, New Hampshire, Massachusetts, Iowa, Vermont, Washington DC, Connecticut, Maryland and Washington

Thirty-one US states have banned same-sex marriage through law or constitutional amendment Wedding joy for NY couples

The Obama campaign had opposed that measure, which was passed with 61% in favour and 39% against.

In the US, 31 states have passed constitutional amendments or legislation against same-sex marriage.

Meanwhile, Mr Romney set the stage for an election year clash over the polarising social issue by saying he was against gay marriage.

The former Massachusetts governor told a Fox News affiliate: "I do not favour marriage between people of the same gender, and I do not favour civil unions if they are identical to marriage other than by name.

"My view is the domestic partnership benefits, hospital visitation rights, and the like are appropriate but that the others are not."