Former White House senior adviser David Axelrod confirmed something many had long suspected: that Obama supported same-sex marriage, even as he was declaring publicly that he didn’t. (Steven Senne/AP)

Barack Obama’s big pitch for the presidency was partly predicated on the idea that he was an antidote to cynicism.

“What the cynics fail to understand is that the ground has shifted beneath them, that the stale political arguments that have consumed us for so long no longer apply,” he declared in his first inaugural address.

But Tuesday, one of his top outside advisers confirmed something many had long suspected: that Obama supported same-sex marriage, even as he was declaring publicly that he didn’t. It was a calculation that reflected the political assumption of the time, wrote former White House senior adviser David Axelrod, which was that being in favor of gay marriage put a politician out of sync with the mainstream.

The revelation — which Axelrod details in his new book, “Believer: My Forty Years in Politics,” and was first reported by Time magazine — did not appear to have any serious political consequences for a president who is regarded as a champion among the LGBT community. But it shows that Obama made some of the same political concessions that he decried in his rivals.

“It was always a difficult issue for him,” Axelrod said in an e-mail. “Nothing galled him more than when he felt restrained by politics.”

President Obama said in an interview with BuzzFeed News that he anticipates a Supreme Court ruling will recognize same-sex couples as being entitled to “the same rights as everybody else.” (Reuters)

However in an interview BuzzFeed News posted late Tuesday night, Obama said Axelrod is “mixing up my personal feelings with my position on the issue.”

“I always felt that same-sex couples should be able to enjoy the same rights, legally, as anybody else and so it was frustrating to me not to, I think, be able to square that with what were a whole bunch of religious sensitivities out there,” the president said.

Obama added that he initially thought civil unions were “a sufficient way of squaring the circle” but shifted course after seeing “the pain and the sense of stigma that was being placed on same-sex couples who are friends of mine.”

On Tuesday White House press secretary Josh Earnest said Obama had been outspoken on gay rights for several years and “time and again [has] been somebody who’s been fighting for justice and equality. And that, I think, will be . . . one of the most important legacies of his presidency.”

As an Illinois state Senate candidate in 1996, Obama indicated on a questionnaire that he supported same-sex marriage. But when he ran for president in 2008 — four years after anti-gay initiatives won in 11 states — he said he supported civil unions because of his faith.

“I believe that marriage is the union between a man and a woman,” Obama told the Rev. Rick Warren in front of an audience at Saddleback Church, prompting applause. “Now, for me as a Christian, it’s also a sacred union. You know, God’s in the mix.” That kind of sentiment helped Obama capture a third of the young, white, evangelical vote in 2008 , triple the share John Kerry had won four years earlier.

According to Axelrod, however, Obama privately acknowledged all along that he had no problem with same-sex marriage. By the end of 2011 he informed his campaign advisers, including Axelrod, that he wanted to figure out a way to convey that publicly. At the time the Illinois legislature, in which Obama had served, had approved civil unions for gay couples, and some lawmakers in the state were pushing to legalize same-sex marriage.The president, Axelrod wrote in an e-mail, “made it clear to all of us that he expected to be asked how he would vote on gay marriage if he was in the legislature, and that he was going to say yes.”

Obama’s top political aides worried that any endorsement of same-sex marriage could depress turnout among African Americans, a critical part of his base; Axelrod wrote that the president’s 2012 campaign manager, Jim Messina, warned Obama that it could cost him North Carolina in his reelection bid. (Obama ended up losing the state in 2012 after winning it in 2008.)

Support for the issue among African Americans has consistently trailed the national average , according to Pew Research Center polls, but grew from 26 percent in 2008 to 42 percent in 2014.

“I understand why he might be reluctant to come out fully in support of same-sex marriage and also why he would be reluctant about the position that churches might be put in, in terms of facing some legal coercion [to conduct same-sex ceremonies] when it is against their faith to do so,” said Bishop Charles E. Blake, an Obama ally and gay-marriage opponent who serves as the presiding bishop at the Church of God in Christ, the nation’s largest Pentecostal denomination.

Ultimately, Obama declared his support in May 2012. In the midst of a tight reelection campaign, his hand had been forced: Just days earlier, Vice President Biden surprised the White House by declaring that he was “absolutely comfortable” with men marrying men, and women marrying women. By that year, according to Pew, the share of Americans in favor of same-sex marriage outnumbered those against for the first time.

Gay rights groups, listing the litany of policies the administration has championed over the past six years, said they were undisturbed by the fact that Obama might have hidden his true feelings on a hot-button political issue. Under Obama, the federal government declined to defend the Defense of Marriage Act, helping pave the way for a 2013 Supreme Court ruling that has expanded legalization of same-sex marriage in states across the country; it ended the military’s Don’t Ask, Don’t Tell policy, which expelled openly gay service members; and it banned anti-LGBT discrimination in the federal civilian workforce and among federal contractors.

Just this week the State Department confirmed that it will appoint a special diplomatic envoy to promote LGBT rights overseas.

“As to the past, who am I to judge?” James Esseks, who directs the American Civil Liberties Union’s Lesbian Gay Bisexual and Transgender Project, said in an interview. “I don’t know what his positions were or weren’t, but I’m so thrilled he is president, because he has done more on LGBT rights than any other administration, ever.”

And Fred Sainz, spokesman for the Human Rights Campaign, said Obama’s decision to retreat on same-sex marriage and then embrace the issue several years later was “a political calculation” that “helped advance this issue significantly” because it gave Americans more time to accept it. “The president gave them that space to be on that journey with him.”

Some members of the African American religious community questioned why Obama was not more forthright with voters from the outset.

“I wasn’t surprised, because the president has been consistently a card-carrying liberal on social issues. It was out of character for him to take a stand against it during the campaign, though it was politically expedient,” said Cheryl Sanders, a professor of Christian ethics at Howard University. “From a political point of view it was very astute, but I think it was probably morally problematic.”

Scott Clement contributed to this report.