The American president described his sudden endorsement of gay marriage as a process of “evolution”, spurred by conversations with his staff and family.

“I have to tell you that over the course of several years as I have talked to friends and family and neighbours, when I think about members of my own staff who are in incredibly committed monogamous relationships, same-sex relationships, who are raising kids together; when I think about those soldiers or airmen or marines or sailors who are out there fighting on my behalf and yet feel constrained, even now that ‘don’t ask, don’t tell’ is gone, because they are not able to commit themselves in a marriage, 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,” Obama told ABC News’ Robin  Roberts for Good Morning America.

Obama backs civil unions for gay and lesbian couples that provide the rights and benefits enjoyed by married couples, although not defined as “marriage”.

His announcement comes after vice president Joe Biden pronounced himself “absolutely comfortable” with allowing same-sex couples to wed.

Obama said states would still be left to decide on the issue on their own, but he was confident his decision would trigger a tide of change.

It’s interesting, some of this is also generational,” the president continued. “You know when I go to college campuses, sometimes I talk to college Republicans who think that I have terrible policies on the economy, on foreign policy, but are very clear that when it comes to same-sex equality or, you know, sexual orientation, that they believe in equality. They are much more comfortable with it. You know, Malia and Sasha, they have friends whose parents are same-sex couples. There have been times where Michelle and I have been sitting around the dinner table and we’re talking about their friends and their parents and Malia and Sasha, 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 his wife Michelle was involved in his decision to back gay marriage outright, even if it’s at odds 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 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, but it’s also the Golden Rule, you know, treat others the way you would want to be treated.”

Until now the president has opposed gay marriage throughout his entire career in national politics. His change of stance is bound to create shaky ground amid 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.”