Police are treating the killings at the Emanuel AME Church in Charleston on June 17 as a hate crime.
Dylann Roof, 21, appeared in court on June 19 to face nine murder charges.
He showed no emotion as relatives of the victims addressed him directly.
“I forgive you” said one victim’s daughter, fighting back tears.
Speaking in at the US Conference of Mayors in San Francisco, President Barack Obama said: “The apparent motivations of the shooter remind us that racism remains a blight that we have to combat together.
“We have made great progress, but we have to be vigilant because it still lingers.
“And when it’s poisoning the minds of young people, it betrays our ideals and tears our democracy apart.”
The president also praised the families of the victims for the forgiveness they had shown.
Barack Obama said it was “an expression of faith that is unimaginable but that reflects the goodness of the American people”.
He also called for a new debate on gun control, and pushed Congress to follow public opinion.
“It’s not enough for us to express sympathy; we have to take action,” the president said.
A previous proposed bill banning assault weapons failed to win backing in the Senate.
At a Charleston sports arena, thousands gathered on June 19 to remember the victims with prayers. They joined hands to sing We Shall Overcome.
Ahead of the vigil, Charleston Mayor Joseph Riley said: “A hateful person came to this community with some crazy idea he’d be able to divide, but all he did was unite us and make us love each other even more.”
A steady stream of people also brought flowers to place at a memorial in front of the church.
Dylann Roof family earlier released a statement through their lawyer.
“Words cannot express our shock, grief and disbelief as to what happened that night. We are devastated and saddened by what occurred,” the family wrote.
“We have all been touched by the moving words from the victims’ families offering God’s forgiveness and love in the face of such horrible suffering.”
In court in Charleston on June 19, Dylann Roof spoke to confirm his name, age and address and said he was unemployed.
Then relatives were invited by the judge to come forward and speak.
At least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…
Elon Musk has said he will give away $1 million a day to a registered…
India and Canada have decided to expel their top envoys along with other diplomats as…