President Barack Obama and his advisers agonized for months over whether the president would publicly support gay marriage.

Obama said in interview earlier this month with ABC News' Robin Roberts that he supports equal marriage rights for gay and lesbian couples. Previously, the president had said he favored civil unions and was “evolving” on marriage.

The haste with which the interview was arranged fueled the narrative that Obama's endorsement was forced by Vice President Joe Biden's supportive remarks made four days earlier.

But in an exhaustive New York magazine feature on the Obama campaign, John Heilemann notes that the issue had been on the table for months.

“The question of whether Obama's new stance narrows or widens his path to victory in November is one that [White House communications director David] Plouffe and his comrades have been agonizing over since early this year, when their boss returned from vacation and told them he wanted to take the plunge. The possible political benefits are clear: jazzing up young voters, ginning up gay dollars. As are the costs: turning off socially conservative Democrats and independents, particularly in four pivotal swing states – Iowa, Ohio, North Carolina, and Virginia. But as to the net effect of the announcement on Obama's ability to accumulate 270 electoral votes, his adjutants are unable to render a firm verdict,” Heilemann wrote.

“I think there is more upside potential than downside potential,” Plouffe is quoted as saying. “But is there a scenario where it's harder? Yes.”