The casket of Rev. Clementa Pinckney sits beneath the podium as President Barack Obama delivers the eulogy during his funeral service, Friday, June 26, 2015, in Charleston, S.C. (David Goldman/AP)

President Obama was sitting across from the first lady and senior adviser Valerie Jarrett on Marine One, headed to Andrews Air Force Base and then Charleston, S.C., when he shared a thought.

“I may sing,” he said, as the White House and the monuments of official Washington receded into the background.

A few hours later he was standing on a stage at the College of Charleston. Behind him were church elders in flowing purple robes. He could hear the strains of electric guitar and drums pulsing in the background and see the thousands of mourners for the parishioners who had been slain nine days before, urging him on throughout his eulogy.

Twice he spoke the opening words of the Christian hymn “Amazing Grace.” Then he paused for 13 seconds as the hushed crowd waited, unsure what was happening.

“Amazing Grace,” he sang softly in a rich baritone.

President Obama brought mourners to their feet during his eulogy of South Carolina state Sen. Clementa Pinckney as he sang a verse from the song "Amazing Grace." (The Washington Post)

“Ha!” one of the pastors behind him called out.

“Sing it, Mr. President,” another said.

Soon thousands in the auditorium were singing along with him.

For years, the private Obama has remained largely that. Now, the president’s private and public persona have merged more fully.

The moment in Charleston came at the end of a long eulogy in which Obama delivered an unflinching accounting of what he described as the country’s “many unhealed wounds” on the issue of race. He spoke in the cadences of the black ministry, decrying the fact that a young man named “Jamal” was less likely to get called back for a job than someone named “Johnny.”

Earlier that day, Obama had described the Supreme Court’s decision to legalize same-sex marriage nationwide — something he had opposed publicly until the spring of 2012, even though he told aides privately he endorsed the idea — “a victory for America.” Hours later the White House was bathed in rainbow colors.

A heckler protesting U.S. immigration policy was removed during President Obama address at a White House reception in celebration of Pride month. (AP)

It is part of a shift that the president and his wife, Michelle, have undergone in the past few months. They are talking more openly about controversial issues — race, first and foremost — and in deeply personal terms.

Jarrett described it as “a call to action,” prompted by the country’s current circumstances. “I don’t think those messages, in isolation, would be as effective or listened to as closely,” she said in an interview Saturday. “The context gives people greater permission to listen, and act.”

It is unclear how this approach will translate into concrete policy measures. Aides hold out hope that Congress will take up criminal justice, which has bipartisan support, but most other proposals Obama has offered to address racial disparities in the United States have met with resistance on Capitol Hill. “We don’t need more talk” on race, the president said in Charleston.

But he is still talking, and a new tone is visible in formal interviews a well as off-the-cuff remarks. In the past week and a half, the president told a podcast host in a Pasadena, Calif., garage that he was now “fearless,” and he laughingly chided a heckler at a White House reception Wednesday that she had no right to taunt him over immigration policy “after drinking my booze.”

The president’s growing comfort is driven in part, aides said, by his confidence after so much time in office and his desire to connect with an electorate that in many cases has stopped listening to the largely gridlocked political debate in Washington. No place has the shift been more clear in recent days than on gay marriage.

During his run for the presidency, Obama carefully calibrated and hid his views on the subject in an effort to appease a divided electorate, according to a book by his former political strategist David Axelrod. “I’m just not very good at bullshitting,” Obama told Axelrod, after an event where he stated his opposition to same-sex marriage, according to the book.

On Friday in the Rose Garden, in his speech celebrating the Supreme Court’s decision on gay marriage, Obama seemed to be searching for words that captured his feelings about the historic decision.

He capped his nine-minute statement by departing from his prepared remarks and ad-libbing the end of his speech. “What an extraordinary achievement,” he concluded. “What a vindication of the belief that ordinary people can do extraordinary things. . . . America should be very proud.”

There have been moments, particularly in his battles with a gridlocked Congress and on foreign policy, where the president has seemed smaller than his office. “He disappeared into the apparatus of the White House,” said a senior administration official. “Now he’s emerging. He’s the same guy, just further down the road and a little wiser.”

While Obama said Friday that those cheering the decision must “recognize different viewpoints” on the issue of gay marriage, he and his aides made it clear in dramatic fashion that evening which viewpoint they saw as morally just.

Three weeks ago, Jarrett’s aide Aditi Hardikar, the LGBT liaison in the White House Office of Public Engagement, suggested they illuminate the White House with a rainbow if the Supreme Court legalized same-sex marriage. Working with the first lady’s chief of staff, Tina Tchen, Jarrett and her aides consulted with the National Park Service and U.S. Secret Service and got gay rights organizations to underwrite it so it did not cost the taxpayers money.

The president accepted the idea matter-of-factly when Jarrett raised it. “It’s a great idea if you can get it to work,” she recalled him saying.

To conservative activists such as Steven Hotze, who is trying to block the issuance of marriage licenses to gay couples in Texas, the move felt like a personal assault.

“It was despicable,” he said. “His actions were just despicable actions.”

But those who gathered in front of the White House over the course of a long, balmy Washington evening Friday felt differently. Current and former White House staff members who had worked on gay rights issues reunited on the North Lawn to watch the light show as the residence became the backdrop for thousands of celebratory selfies. One same-sex couple posed with a sign that read: “Not just gay, ecstatic,” while the image flooded social media with tens of millions of Facebook, Twitter and Snapchat posts and video views.

But those images had to vie with the videos of Obama belting out “Amazing Grace” and decrying the long shadow of slavery and Jim Crow on the American psyche, a moment that surprised many Americans who had gotten used to watching their president.

As for Obama, the only thing that startled him was that it took only two words before the whole crowd joined in. “He knew he would not get far before he had company,” Jarrett said.

greg.jaffe@washpost.com