After a momentous week, same-sex couples can now marry in all 50 states, the Confederate flag's historic hold on the political institutions of the Deep South is fraying by the hour and Obamacare, after defying another attempt to dismantle it, is now reaffirmed as the law of the land.

And as a capstone to these seismic events, the first black president of the United States spent Friday afternoon singing "Amazing Grace" on live television in front of an African American congregation.

Political and social conventions on civil rights and race relations that for decades have seemed immovable are being swept away in a cascade of grass-roots change. Politicians have been left struggling to keep up.

"Progress on this journey often comes in small increments," President Barack Obama said Friday, arguing that the task of each generation is to honor the Constitution's guarantee of equal rights as the times change.

"(It's) sometimes two steps forward, one step back, compelled by the persistent effort of dedicated citizens," he said, describing the process of transformational political change around which he has built his political career.

"And then sometimes there are days like this, when that slow, steady effort is rewarded with justice that arrives like a thunderbolt," Obama said, moments after the Supreme Court delivered its historic decision legalizing same-sex marriage nationwide.

The pace of change is bewildering to some political figures, activists and candidates. In the case of the Confederate flag and gay rights, the shifts are happening despite politicians and not because of them: Federal and state leaders are simply being overtaken by the people on several key issues.

But the swift torrent of change no doubt has far-reaching political implications.

After speaking about the historic gay rights ruling, Obama climbed aboard Air Force One to head to South Carolina for his final duty of an emotionally draining week, the funeral of Pastor Clementa Pinckney, the most prominent of the nine people killed in Charleston massacre.

JUST WATCHED Obama sings 'Amazing Grace' during eulogy for pastor Replay More Videos ... MUST WATCH Obama sings 'Amazing Grace' during eulogy for pastor 01:44

He turned on the political theatrics again, delivering a eulogy that turned into a moving sermon on race, the experience of being black and the power of faith. Before an enthralled congregation, Obama embraced his status as the first African American president as never before, calling for action to counter discrimination. It was a fitting end to a historic week, as it showed Obama had shed his former reticence to talk about race -- and the nation may not look on its president quite the same way again.

"We talk a lot about race ... we don't need more talk," Obama said, adopting the cadences of a preacher, condemning employment discrimination and the attitude that results in someone being told "call Johnny back for a job interview but not Jamal."

Then, in what will surely become one of the iconic moments of his presidency, Obama paused before hitting the first notes of the hymn "Amazing Grace," with the organist providing backup and the congregation joining in -- a moment of joy amid sorrow.

Tharon Johnson, a Georgia political consultant who ran Obama's southern campaign in 2012, said the president, who referred to church as a place for African Americans to call "our own" and who used the 'N-word' in a podcast that went viral on Monday to argue racism was not dead, was speaking to multiple audiences.

"Today, President Obama not only spoke as the president of the United States, but he was able to articulate a healing and soothing message to the predominantly African American audience. There was no other person that could have given that eulogy. His singing of 'Amazing Grace' was epic."

Kareem Crayton, a University of North Carolina law professor, said Obama's speech was the finest of his presidency.

"I think what we saw today was what a black man who served in the nation's top office for six years sees when he looks out on America. You heard in the words the emotion, the sense of where we are and what we have to do," he said.

Even before Obama's appearance in Charleston, the events of the last five days were likely to have far-reaching political implications.

Friday's 5-4 Supreme Court ruling giving same-sex couples the right to marry nationwide was just the latest development that appears to boost liberals and challenge conservatives determined to preserve traditional values.

It provided an immediate test for Republican presidential candidates a day after the Supreme Court upheld the Affordable Care Act, the centerpiece of Obama's domestic legacy, which the GOP is still vowing to overturn.

The gay rights decision seemed to trap Republican leaders between the conservative attitude on social issues that is vital to their political base and the widening acceptance of gay rights among more moderate voters that the court's judgment seems to reflect.

"The Supreme Court has spoken with a very divided voice on something only the Supreme Being can do -- redefine marriage," said 2016 Republican candidate Mike Huckabee, siding immediately with evangelicals in the conservative base.

"I will not acquiesce to an imperial court any more than our Founders acquiesced to an imperial British monarch," Huckabee said. "We must resist and reject judicial tyranny, not retreat."

And Florida Sen. Marco Rubio offered the first hints of a conservative fight, placing the future ideological direction of the Supreme Court -- and the likelihood that the next president will have the chance to replace several aging justices -- at the center of the 2016 campaign.

"As we look ahead, it must be a priority of the next president to nominate judges and justices committed to applying the Constitution as written and originally understood," Rubio said in a statement.

And despite the forest of gay rights activists' rainbow flags that overwhelmed the marble plaza in front of the Supreme Court Friday, there are signs this battle in the culture wars will not be abandoned just yet — especially with possible Supreme Court cases on issues like abortion looming in the near future.

Chief Justice John Roberts, in his dissent to the majority court ruling, complained that "five lawyers" -- namely his colleagues on the highest bench in the land -- had taken it upon themselves to redefine the institution of marriage as it had been accepted by multiple civilizations throughout history.

"Celebrate today's decision. Do not celebrate the Constitution, it has nothing to do with it," said Roberts in the waspish conclusion to his dissent.

JUST WATCHED Should Confederate history be taken down from the U.S. Capitol? Replay More Videos ... MUST WATCH Should Confederate history be taken down from the U.S. Capitol? 01:25

Kerri Kupec of the Alliance Defending Freedom picked up Roberts's contention that the court's decision had cut off a democratic process through which people were weighing in on gay marriage in elections and state ballot initiatives.

"I think we are heading into uncharted territory with respect towards regards religious freedom," Kupec told CNN, arguing that the marriage ruling called into question the right of people to view the institution in accordance with their faith.

Another example of people power outpacing politicians is unfolding in South Carolina following the massacre.

Just over a week ago, Republican political leaders were arguing that the fate of the Confederate flag, which is revered by some white supremacist groups, was a matter for the states alone. But that position quickly became unsustainable.

Similar calls came from leaders elsewhere in the South, as major corporations like Walmart announced they would stop selling Confederate Flag merchandise.

While the events of a dizzying week will have a broad impact for decades to come, they also represent an important, personal boost for Obama, who continues to defy expectations that he is a lame duck as his second term enters its twilight years.

While the administration did not bring the case that rewrote the law on gay marriage, it did side with the plantiffs -- allowing the White House to argue it is on the right side of history.

Even before Friday, Obama was celebrating a stunning week in which the Supreme Court in a 6-3 ruling rejected a second legal challenge to the Affordable Care Act and Republicans, who have often thwarted the president's agenda, worked with him to secure fast-track authority to negotiate trade agreements, including a legacy-boosting pan-Pacific pact.

Next up is the prospect of a nuclear deal with Iran, as U.S. negotiators head to Europe to try to clinch a final agreement that would represent a striking, if partial, break with more than 30 years of visceral hostility between Washington and Tehran.

And there can be little doubt that Obama, after a presidency marred by political polarization in Washington and successive economic and foreign policy crises, views this roller coaster week as confirmation of his own belief in the power of people to defy the inertia stifling their political institutions, whether they be equal marriage campaigners seeking the basic right to wed or prayerful congregants in South Carolina offering mercy to a killer.

"What a vindication of the belief that ordinary people can do extraordinary things," he said after Friday's Supreme Court ruling, which came after years of campaigning by gay rights activists. "What a reminder of what Bobby Kennedy once said, about how small actions can be like pebbles being thrown into a still lake, and ripples of hope cascade outwards and change the world."