South Carolina removed the Confederate battle flag from the state capitol grounds on Friday to chants of "USA, USA!," after three weeks of emotional debate over the banner, a symbol of slavery and racism to many, but of Southern heritage and pride to others.

In a solemn, yet joyful ceremony before a crowd of about 10,000 people, an honour guard of white and black state troopers lowered the flag shortly after 10 a.m. ET.

Gov. Nikki Haley stood on the Statehouse steps along with family members of the victims and other dignitaries. While she didn't speak, she nodded and smiled in the direction of the crowd after someone shouted: "Thank you governor."

Haley supported the flag before the shooting, but the Republican had a change of heart in the days after the killings and led the push to get legislators to pass a bill before the end of the summer. She signed the legislation Thursday.

As she looked on, two white troopers rolled up the flag neatly and tied it with a white ribbon. They handed it to a black trooper who brought it to the Statehouse steps.

Earlier, Haley called it 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.

Also among those watching the flag's lowering was Charleston Mayor Joe Riley, who in 2000 led a 190-kilometre march from his city to Columbia to protest the flag.

"Today, at long last, this has been done," he said in a statement.

Highway Patrol Cpl. Rupert Pope downplayed the significance of their race in the ceremony.

"We're all grey," he said, with the other officers nodding in agreement.

Flag moved to 'relic room'

This marks the first time since the civil rights movement that the Confederate flag was removed entirely from the statehouse. Many people believed the flag would fly indefinitely in this state, which was the first to leave the Union. But the killing of nine black church members during a Bible study in Charleston last month changed that sentiment and reignited calls to bring down the Confederate flags and symbols across the nation.

The banner's new home will be the Confederate Relic Room and Military Museum, where the flag will reside with other artifacts carried by Southern Confederate soldiers 150 years ago in the Civil War. There, it eventually will be housed in a multimillion-dollar shrine lawmakers promised to build as part of a deal to get a bill passed removing the flag.

President Barack Obama tweeted minutes after the flag was down, saying it was "a sign of good will and healing and a meaningful step towards a better future." 

The honour guard was the same group of men who carried state Sen. Clementa Pinckney's coffin into the Statehouse for a viewing last month. Pinckney was also pastor of the church where the killings took place.

Denise Quarles' mother, Myra Thompson, received her license to preach just hours before the June 17 shooting at Emanuel African Methodist Episcopal Church in Charleston.

Quarles said the group known as the Emanuel 9 smiled from heaven as the Confederate flag was taken down for good.

"The tragedy was a tragedy. But now on the other side of that tragedy, we see a lot of positives coming out. Maybe people will change their hearts," Quarles said.

'Feel the togetherness'

The white man charged in the killings, 21-year-old Dylann Roof, appeared in photographs posing with a Confederate flag that surfaced on a website bearing a racist manifesto. The image spurred politicians and leading national retailers to pull the flag from display. 

Confederate Flag

South Carolina Gov. Nikki Haley signs Senate Bill 897 into law on Thursday at the State House in Columbia. The law enabled the removal of the Confederate flag from the State House grounds more than 50 years after the rebel banner was raised to protest the civil rights movement. (John Bazemore/Associated Press)

In South Carolina, the first state to secede during the 1861-1865 U.S. Civil War, this week's debate in the state legislature brought an emotional closure to a symbol long divisive in the state.

The Confederate flag waved atop the state capitol from 1961 to 2000, when it was moved to a Confederate war memorial near the State House entrance.

"My heart is overjoyed. I can feel the togetherness," said Tenetha Hall, of Newberry, S.C., who said she took a day off work to drive an hour to Columbia to watch the flag come down. "I'm so glad my children and six grandchildren will get to see this history."

Civil War re-enactor Bobby Dawson stood quietly in gray wool pants and a long-sleeved shirt with the wool coat of the Confederate Army's 101st South Carolina Regiment. He said he had an ancestor who fought on both sides of the Civil War.

"This brings joy to some people, a solemn occasion to others," Dawson said.