Charleston - President Barack Obama on Friday delivered a rousing eulogy for a black pastor slain in the Charleston massacre, addressing the strains in America over race and gun control before bursting into a soulful hymn.Dubbed the "reverend president" by his South Carolina hosts, Obama led thousands of mourners in singing "Amazing Grace" - an emotive homage likely to be remembered as one of the defining moments in his presidency.Clementa Pinckney, pastor at the historic Emanuel African Methodist Episcopal Church and also a state senator, was shot dead along with eight of his congregants in Charleston last week, an apparently racially motivated attack that shocked the nation."What a good man," Obama said, praising Pinckney, who he knew personally. "Sometimes I think that's the best thing to hope for when you're eulogised."The Confederate flagMuch of Obama's address was focused not directly on Pinckney, but on social strains that his death has underscored: race, gun control and the country's Civil War.America's first black president said the Confederate flag - the Civil War standard of the white slave-owning south that was taken up by alleged gunman Dylann Roof - was not just an emblem of heritage."For too long, we were blind to the pain that the Confederate flag stirred in too many of our citizens," Obama said in charged and combative remarks."The flag has always represented more than just ancestral pride," he said."For many, black and white, that flag was a reminder of systemic oppression and racist subjugation. We see that now."Removing the flag from public buildings, he said, would not be an act of political correctness or 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.""It would be one step in an honest accounting of American history."'Unique mayhem' of gunsObama drew a line between the June 17 shooting at a Bible study class at the Emanuel AME Church and past brutal treatment of black Americans."It was an act that drew on a long history of bombs and arson and shots fired at churches - not random but as a means of control, a way to terrorise and oppress," he said.Roof, 21, has been charged with nine counts of murder and a related weapons charge. He is in custody in a South Carolina jail.Obama said America had ignored the toll of gun violence for too long and again pleaded for action, as he has done several times since the killings."We've been blind to the unique mayhem that gun violence inflicts upon this nation," he said."The vast majority of Americans, the majority of gun owners, want to do something about this."Obama referred to other mass shootings that have shocked America -- the Newtown school massacre in 2012, the killings in a Colorado movie theater earlier that same year."Whatever solutions we find will necessarily be incomplete. But it would be a betrayal of everything Reverend Pinckney stood for, I believe, if we allowed ourselves to slip into a comfortable silence again," he said.‘We need to come together’Obama, having seen previous initiatives to control gun ownership fail in Congress, has expressed anger and declared that "at some point" America would have to act.The city of Charleston has tried to come together after the killings.Some mourners arrived in the early hours under a blistering summer sun, forming long lines at a city arena and anxious to secure seats for Friday's service."We need to come together," said 66-year-old Rose Marie Manigault, who made the short trip from Mount Pleasant to pick her spot just before dawn broke over the gathering throng.Before Obama's eulogy, church Bishop John Richard Bryant told mourners, eliciting cheers, that Roof "wanted to start a race war but he came to the wrong place."Along with Obama and his wife Michelle, Vice President Joe Biden, Republican House Speaker John Boehner and Democratic presidential candidate Hillary Clinton attended Friday's service.Pinckney's widow Jennifer and his daughter Malana wrote messages of remembrance in the program."We believe that your life mattered. It mattered to us, and it will forever change the culture and mindset of the world," said his wife."I love you so much!" wrote Malana.