The US state of South Carolina removed the Confederate flag from the state capital grounds where it has flown for more than a half-century, a stunning turn after a final push sparked by the shooting deaths of nine black churchgoers.

President Barack Obama said taking down the Confederate flag was "a sign of good will and healing and a meaningful step toward a better future."

Obama posted his reaction on Twitter on Friday, minutes after the flag was removed from a flagpole on the grounds of the South Carolina Statehouse.

The banner, which went up on the State House grounds 54 years ago at the height of the US civil rights movement, was removed shortly after 10am (1400 GMT) in a short ceremony before a large crowd and live TV cameras.

The flag's new home will be the "relic room" of the state military museum in Columbia, South Carolina's capital, where the flag will reside with other artifacts carried by Southern Confederate soldiers 150 years ago in the Civil War.

The flag is coming down 23 days after the massacre of state Senator Clementa Pinckney and eight others inside Charleston's Emanuel African Methodist Episcopal Church.

South Carolina Republican Governor Nikki Haley, who had pledged a day earlier to "bring it down with dignity," called Friday a great day for the state in an interview with NBC's "Today" television show.

"I'm thinking of those nine people today," Haley said, referring to the nine men and women gunned down at Charleston's African Methodist Episcopal church.

Authorities say they believe the killings were racially motivated. By posing with the Confederate flag before the shootings, suspect Dylann Storm Roof, who has not yet entered a plea to nine counts of murder, convinced some that the flag's reputation for white supremacy and racial oppression had trumped its symbolism of Southern heritage and ancestral pride.

"People say he was wrapped in hate, that he was a hateful person," said Democratic Representative Justin Bamberg. "Well, his hate was wrapped in the cloak of that Confederate flag. That is why that flag is coming down."

South Carolina's leaders first flew the rebel battle flag over the Statehouse dome in 1961 to mark the 100th anniversary of the Civil War, when the pro-slavery South seceded and fought the northern Union. It remained there to represent official opposition to the civil rights movement.

Decades later, mass protests against the flag by those who said it was a symbol of racism and white supremacy led to a compromise in 2000 with lawmakers who insisted that it symbolised Southern heritage and states' rights. The two sides came to an agreement to move the flag from the dome to a 9-meter pole next to a Confederate monument in front of the Statehouse.

States across the US are moving on without their Confederate symbols. The rebel flag is gone from the Alabama Capitol, and the US House of Representatives voted that it can no longer fly at historic federal cemeteries in the Deep South.