With a rousing eulogy and a chorus of "Amazing Grace," President Barack Obama called on the country Friday to honor the nine victims of the South Carolina church massacre by working toward racial healing.
He said that includes removing the Confederate flag from the State House grounds, which he said would be not an act of political correctness but a "meaningful balm" for the unhealed wounds of slavery and the Jim Crow era.
"It's true, the flag did not cause these murders," Obama said, but "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."
"By taking down that flag," he said, "we express God's grace."
The remarks came in a eulogy for Rev. Clementa Pinckney, the pastor and state senator who was among nine people gunned down at a Bible study at Emanuel African Methodist Church in Charleston last week.
Obama described the nine killed as "good people, decent people, God-fearing people. People so full of life and so full of kindness, people who ran the race, persevered. People of great faith."
"To the families of the fallen," he said, "the nation shares in your grief. Our pain cuts that much deeper because it happened in a church."
Read MoreWhere the Confederate flag belongs
Since the attack, South Carolina's governor has called for the removal of the rebel flag from the Capitol grounds, and symbols of the Confederacy have been removed from other public spaces and store racks.
The assault at Emanuel AME was carried out by Dylann Roof, who had espoused racist ideology and was pictured posing with the Confederate flag on a website in his name.
Obama said that the alleged killer was "blinded by hatred" but never could have imagined the remarkable forgiveness of the families of the victims, nor the "thoughtful introspection and self-examination that we so rarely see in public life."
"He failed to comprehend what Rev. Pinckney so well understood—the power of God's grace," the president said. "He's given us the chance where we've been lost to find our best selves. We may not have earned it, this grace, with our rancor and complacency short-sightedness and fear of each other, but we got it all the same."
The president used the speech to call for a fairer criminal justice system, better training of police and a greater awareness of hiring discrimination.
He also called attention to "the unique mayhem that gun violence inflicts upon this nation," and said the country needs action on gun control, not just talk.
To huge applause, he led thousands of people at the College of Charleston arena in a chorus of "Amazing Grace."
Throngs of people filed through metal detectors, had their bags searched and packed into the College of Charleston's arena for the funeral. A viewing center at a nearby museum was also full.
Pinckney, 41, was a father of two and was at one time the youngest member of the South Carolina House.
"Preacher by 13, pastor by 18, public servant by 23. What a life Clementa Pinckney lived," Obama said. "What an example he set."