President Barack Obama on Friday eulogized the pastor slain in a racist massacre at a historically black South Carolina church, using a turn at the pulpit to deliver an impassioned call to action on race relations, then lifted an emotional crowd of mourners to their feet as he led a rendition of “Amazing Grace.”

Obama remembered the Rev. Clementa Pinckney as “a good man.”

“In the pulpit by 13, pastor by 18, public servant by 23. He set an example worthy of his position, wise beyond his years,” Obama said.

“What a life Clementa Pinckney lived. What an example he set. What a model for his faith.”

Mourners had begun lining up before dawn to bid farewell to Pinckney, 41. A beloved pastor and state senator, he was one of nine worshippers gunned down last week while they studied the Bible at Emmanuel AME Church in Charleston. The confessed shooter, Dylann Roof, has been charged with nine counts of murder. Roof, 21, told authorities he hoped to start a race war.

In his tribute on Friday, Obama warmly recalled how he had met the pastor in 2007 when he first ran for the White House. Now in his second term, the president didn’t shy from using the occasion to hammer home a political message touching on race and gun violence.

He waded into the roiling debate roiling over Civil War symbols, fueled by pictures showing Roof brandishing Confederate flags.

“For too long we were blind to the pain that the Confederate flag stirred in too many of our citizens,” Obama said. “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.”

The shooting has spurred a sudden and swift wave of action across the South to re-examine the Confederate symbol in ways that just days ago would have been unthinkable in the politically conservative region where the symbol — a sign of white supremacy to many — has been embraced by supporters as an emblem of heritage and culture. Prompted by Republican Gov. Nikki Haley, South Carolina lawmakers have begun the process of removing the flag from state Capitol grounds. In other states, efforts are afoot to remove the symbol from license plates and monuments.

Obama evoked the nation’s ugly racial history and the role of the church as a place of resistance and sanctuary for the black community.

“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.

Obama also said the nation has “been blind to the unique mayhem that gun violence inflicts on this nation.”

“It would be a betrayal of everything Reverend Pinckney stood for, I believe, if we allowed ourselves to slip into a comfortable silence again.”

Instead of inciting racial violence, Obama said that Roof’s actions had brought the community together.

“Blinded by hatred, he failed to comprehend what Reverend Pinckney so well understood: the power of God’s grace,” Obama said.

Grace was a theme throughout the speech and, at its conclusion, he launched into the hymn “Amazing Grace.” Pastors on the dais and a church organist seemed surprised, hesitated and then joined in.

Police estimated that 20,000 people attempted to attend the funeral at the College of Charleston’s TD Arena, which holds about 5,400. Many — some who had driven in from other states — had to be turned away. Several hundred were at overflow locations across Charleston, including the Charleston Museum a few blocks from the funeral, and the Cinnebarre Mt. Pleasant movie theater in neighboring Mt. Pleasant.

Pinckneys’s wife, Jennifer, and two young daughters were in attendance.

From Georgia, U.S. Sen. David Perdue was on hand.

And while to some Pinckney has become a symbol, or martyr, some on Friday recalled him as a friend.

The Rev. John H. Gillison said anyone who would have come across Pinckney would have found him to be authentic.

“Sometimes when you observe people from public galleries or from afar … when you sit with them at the dinner table and listen to them as the real person came out,” Gillison said to those inside the arena. With Pinckney, “You found the same man.”

Friends told stories of a shy, quiet man who made an impact through the Word and public legislation. A cousin said their grandmother would sing a song representative of the life Pinckney would lead.

“I want to live so God can use me anyplace, anywhere, anytime,” the cousin said. “You didn’t have to be black. You didn’t have to be a Democrat.” Pinckney “wasn’t a radical. He wasn’t even pro-black. But if you approach him with a wrong you wanted to make right, he wouldn’t stop til it was right.”

Adria Bernardi and her son, 21-year-old Jacob Stovall, on vacation from Nashville, ended up watching the service from a movie theater in nearby Mt. Pleasant after trying unsuccessfully to get inside the arena at the College of Charleston. They’ve come to the area for vacation the past few years.

Stovall said the few similarities between him and the suspect – both are 21-year-old white men – led him to introspection this week, seeking answers as to how something like this could have happened. President Obama’s speech,though, gave him hope that the mass shooting was an exception, not the rule.

“The speech, President Obama’s eulogy, was just amazing,” Stovall said. “I’m still absorbing it. Hopefully, it’ll be a real moment for change.

Slain along with Pinckney were Cynthia Hurd, 54; Tywanza Sanders, 26; Sharonda Coleman-Singleton, 45; Myra Thompson, 59; Ethel Lance, 70; Susie Jackson, 87; the Rev. Daniel Simmons Sr., 74; and DePayne Doctor, 49.Funerals for six of the remaining victims are expected in the coming days.