Barack Obama never did much to hide the fact that he was wobbly on his opposition to gay marriage. As far back as 2006, he wrote in the book that would be a blueprint for his presidential campaign that “as a christian” he would have to “remain open to the possibility that my unwillingness to support gay marriage is misguided.” More recently he had settled on an odd construction for a politician: He said he was “evolving” on the issue, suggesting an inevitable change in the works that was inexplicably not arriving.

For many of Obama’s most committed supporters, this looked a lot like political expediency, that characteristic that’s as natural to politicians as their insistence that such calculations don’t take place. When Obama’s Vice President Joe Biden went off script on Sunday and admitted what many already assumed to be the President’s position, a comfort and acceptance of gay and lesbian unions, the political cost of maintaining his position went up. Suddenly, he faced an entire campaign season of questions, from reporters, if not in debates, in which he would have had to explain his differences with his own running mate. Each of his answers would have highlighted a characteristic he wants to distance himself from in this election year. If there is one thing that the Obama campaign has made clear in recent months, it is their determination to tar Mitt Romney as the politically expedient candidate.

White House aides, meanwhile, told reporters on Wednesday that Obama had always planned to announce a shift in his position before the election. The only question was when.

So what will be the political cost of Obama’s evolution? His position on gay marriage is unlikely to matter, unless the election is close, as many now expect. Social issues, including marriage, barely register in polls asking voters what the most important issues are for the country, and both Obama and Romney agree that economic issues are likely to shape the debate in the months to come. It is also true that Obama has timed his pivot relatively well. A polling memo released by Obama’s own pollster, Joel Benenson, and Republican Jan van Lohuizen last summer, found rapidly accelerating acceptance of gay marriage, as reflected in this chart:

The same report found a clear generational gap in acceptance of same-sex marriage, citing one Gallup poll that found 70% acceptance among 18 to 34 year olds, while only 55% support among those older than 55. Polling analysis also shows a majority of independent voters support same sex marriage.

But the danger for Obama comes not from broad trends, but specific caches of voters who are only likely to be decisive if the vote in key states is close. Lohuizen, who has not reviewed recent polling on the issue, said three demographics struck him as particularly perilous: Rural socially conservative Democrats in the southern states of Virginia and North Carolina, white blue collar “Reagan Democrats” in the industrial Midwest, and church-going black voters in the south. “A lot of opposition [to gay marriage] comes from African American clergy,” said Lohuizen. “And he needs those guys.”

But Lohuizen also said it is not at all clear that black voters in the south, faced with a choice between Obama and Romney, will not come around to accepting the President’s position. The Obama campaign and the White House are certainly hoping to make it happen. In talking points leaked to the New York Times, White House aides tried to cast the President’s shift on the issue as a religious issue, following the lead of Obama’s writing in 2006:

In the end, the values that the president cares most deeply about is how we treat other people. The president and first lady are both practicing Christians, and obviously this position may be considered to put them at odds with the views of others, but 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: Treat others the way you’d want to be treated.

There is also little evidence that Republicans, who have been damaged in recent months among independents after extensive focus on social issues, want to make an issue of Obama’s shift. On the campaign trail Wednesday, Romney tread gently, telling reporters, “This is a very tender and sensitive topic as are many social issues. But I have the same view I’ve had since, well, since running for office.” Speaker Boehner also declined to dwell on the issue in an interview Wednesday on Capitol Hill, saying Republicans are focused on the economy.