"What a life Clementa Pinckney lived!" Obama said to rounds of applause and "amens." ''What an example he set. What a model for his faith. And then to lose him at 41. Slain in his sanctuary with eight wonderful members of his flock."
"Their church was a sacred place," Obama said, "not just for blacks, or Christians, but for every American who cares about the expansion of liberty. ... That's what the church meant."
Thousands of mourners eagerly awaited Obama's speech, which capped a week of sorrowful goodbyes and stunning political developments. The slayings inside the Emanuel African Methodist Church last week have prompted a sudden reevaluation of the Civil War symbols that were invoked to assert white supremacy during the South's segregation era.
Pinckney came from a long line of preachers and protesters who worked to expand voting rights across the South, Obama said. "In the pulpit by 13, pastor by 18, public servant by 23. He set an example worthy of his position, wise beyond his years."
"We do not know whether the killer of Rev. Pinckney knew all of this history," the president said. "But he surely sensed the meaning of his violent act. It was an act that drew on a long history of bombs, and arsons, and shots fired at these churches; not random, but as a means of control, a way to terrorize and oppress.
"It was an act that he imagined would incite fear, and incrimination, violence and suspicion. An act he presumed would deepen divisions that trace back to our nation's original sin," Obama continued, his voice rising in the cadence of the preachers who preceded him.
"Oh, but God works in mysterious ways!" Obama said, and the crowd rose to give him a standing ovation. "God has different ideas!"
Obama then spoke plainly about the ugliness of America's racial history - from slavery to the many ways minorities have been deprived of equal rights in more recent times. Removing the Confederate battle flag from places of honor is a righteous step toward justice, he said.
"By taking down that flag, we express God's grace. But I don't think God wants us to stop there," Obama said, smiling as the crowd laughed with him.
"For too long, we've been blind to the way past injustices continue to shape the present. Perhaps we see that now. Perhaps this tragedy causes us to ask some tough questions."
The president wrapped up the four-hour funeral in song, belting out the first words of "Amazing Grace" all by himself. The choir, organist and many in the audience stood up and joined him.
Slain along with Pinckney were Cynthia Hurd, 54; Tywanza Sanders, 26; Sharonda Singleton, 45; Myra Thompson, 59; Ethel Lance, 70; Susie Jackson, 87; the Rev. Daniel Simmons Sr., 74; and DePayne Doctor, 49.
Obama named them one by one, shouting that each "found that grace!"
America's first black president sang this spiritual less than a mile from the spots where thousands of slaves were sold and where South Carolina signed its pact to leave the union a century and a half earlier.
"Thank you reverend president," joked the Rev. Norvell Goff, interim pastor of the Emanuel African Methodist Episcopal Church, as Obama stepped away for private meetings with the victims' families.
Throughout the four-hour ceremony, the "Mother Emanuel" choir, hundreds strong, led roughly 6,000 people through rousing gospel standards between speakers.
"Someone should have told the young man. He wanted to start a race war. But he came to the wrong place," The Right Rev. John Richard Bryant said to rounds of applause. A banner alongside Pinckney's closed coffin declared "WRONG CHURCH! WRONG PEOPLE! WRONG DAY!"
Applause also rang out as state Sen. Gerald Malloy, Pinckey's Senate suitemate and his personal lawyer, noted how the slayings have suddenly prompted a reevaluation of Civil War symbols that were invoked to assert white supremacy during the South's segregation era.
"All the change you wanted to see and all the change you wanted to do - because of you, we will see the Confederate flag come down in South Carolina," Malloy said.
Obama and Vice President Joe Biden sang and clapped along as they sat with relatives of the victims in the front row. Also attending were first lady Michelle Obama, Jill Biden, and dozens of prominent lawmakers and civil rights leaders.
Justice Department officials broadly agree the shootings meet the legal requirements for a hate crime, meaning federal charges are likely, a federal law enforcement source told The Associated Press on Thursday, speaking anonymously because the investigation is ongoing.
The revelation that shooting suspect Dylann Storm Roof had embraced Confederate symbols before the attack, posing with the rebel battle flag and burning the U.S. flag in photos posted online, prompted this week's stunning political reversals, despite the outsized role such symbols have played in Southern identity.
Obama praised Gov. Nikki Haley for moving first by asking lawmakers Monday to bring down the flag outside South Carolina's Statehouse. Other politicians then came out saying historic but divisive symbols no longer deserve places of honor.
"It's true the flag did not cause these murders," Obama said. "But as people from all walks of life, Republicans and Democrats, now acknowledge - Gov. Haley's recent eloquence on the subject is worthy of praise - as we all have to acknowledge, the flag has always represented more than just ancestral pride."
"For many - black and white - that flag was a reminder of systemic oppression and racial subjugation. We see that now."
"Removing the flag from this state's capitol would not be an act of political correctness. It would not be an insult to the valor of Confederate soldiers. It would simply be an acknowledgment that the cause for which they fought - the cause of slavery - was wrong. The imposition of Jim Crow after the Civil War, the resistance to civil rights for all people, was wrong.
"It would be one step in an honest accounting of America's history, a modest but meaningful balm to so many unhealed wounds," he said. "It would be an expression of the amazing changes that have transformed this state and this country for the better."
Associated Press Writer Eric Tucker in Washington contributed to this report. Collins contributed from Columbia, S.C.