Former White House adviser David Axelrod claims in his new memoir released Tuesday that President Barack Obama supported gay marriage before his first presidential run.

In his first campaign for the White House, the president endorsed civil unions for gay couples. In endorsing marriage equality in an exclusive 2012 interview with ABC's Robin Roberts, Obama said that he had “evolved” on the issue.

In Believer: My Forty Years in Politics, Axelrod writes that Obama has been in favor of same-sex marriage for as long as he's known him.

“As a candidate for State Senate in 1996 from liberal Hyde Park, he signed a questionnaire promising his support for legalization,” Axelrod writes. “I had no doubt that this was his heartfelt belief.”

Axelrod takes credit for convincing Obama in 2008 to alter his public stance on the issue to be more inline with those in “the black church.”

In 2012, advisers warned the president that to deviate from this message could cost him North Carolina, which adopted a constitutional amendment defining marriage as a heterosexual union that same year. (Obama endorsed marriage equality in May, a day after North Carolina's amendment gained voter approval.)

“By year's end, however, Obama was no longer interested in analysis,” Axelrod writes. “'I just want you guys to know that if a smart reporter asks me how I would vote on this if I were still in the House legislature, I'm going to tell the truth. I would vote yes.'”