South Carolina Governor Nikki Haley has signed a bill to take down the Confederate flag from the state's capitol grounds. The flag is scheduled to come down at 10 a.m. local time Friday.

"Today I am very proud to say that it is a great day in South Carolina," Haley said to a jubilant crowd just before signing.

Haley said the flag will be brought down with dignity. The banner will be taken to the state's Confederate Relic Room for display.

The mayor of Charleston, Joseph P. Riley Jr., issued a statement congratulating the legislators. Charleston was the site of the church shooting last month where nine people were killed.

"Our state's response to a horrific act of racial hatred has been a clear and decisive act of graceful unity, respect and healing for all of our citizens," he said.

13 hours of debate

The signing comes after the South Carolina House approved the bill to take down the Confederate flag from the capitol grounds, which was a stunning reversal in a state that was the first to leave the Union in 1860 and raised the flag again at its Statehouse more than 50 years ago to protest the civil rights movement.

The move early Thursday came after more than 13 hours of passionate and contentious debate, and just weeks after the fatal shootings of nine black church members, including a state senator, at a Bible study in Charleston.

"South Carolina can remove the stain from our lives," said 64-year-old Rep. Joe Neal, a black Democrat first elected in 1992. "I never thought in my lifetime I would see this."

The House approved the Senate bill by a two-thirds margin.

Haley herself reversed her position on the flag, saying the pain, grief and grace of the families of the victims in the shooting at Emanuel African Methodist Episcopal church caused her to realize that while some conservative whites saw the Confederate flag as a symbol of pride in their Southern ancestors, most of the blacks who make up a third of the state's population see it as a dark reminder of a racist past.

The man charged in the shooting, Dylann Roof, brought that view home, telling survivors of the attack that he killed blacks because they were raping white women and taking over the country, according to witnesses. Roof also reportedly took photographs of himself holding the Confederate flag.

Frustration with Republicans

A group of Republicans had mounted opposition to immediately removing the flag, but at each turn, they were beaten back by a slightly larger, bipartisan group of legislators who believed there must be no delay.

The Confederate flag has flown on the state capitol grounds in South Carolina since the height of the civil rights movement. It is scheduled to come down Friday. (Mladen Antonov/Getty Images) As House members deliberated well into the night, there were tears of anger and shared memories of Civil War ancestors. Black Democrats, frustrated at being asked to show grace to Civil War soldiers as the debate wore on, warned the state was embarrassing itself.

The closest vote in the GOP-controlled body came on an amendment to place the state flag beside the monument to Confederate soldiers at the front of the Statehouse. But it failed 60-60.

Changing the Senate bill could have meant it would take weeks or even months to remove the flag, perhaps blunting momentum that has grown since the church massacre.

Republican Rep. Jenny Horne reminded her colleagues she was a descendent of Confederate President Jefferson Davis, and scolded fellow members of her party for stalling the debate with dozens of amendments.

She cried as she remembered the funeral of her slain colleague state Sen. Clementa Pinckney, the pastor of Emanuel African Methodist Episcopal church, who was gunned down as his wife and daughter locked themselves in an office.

"For the widow of Sen. Pinckney and his two young daughters, that would be adding insult to injury and I will not be a part of it!" she screamed into a microphone.

She said later during a break she didn't intend to speak but got frustrated with fellow Republicans.

'New vestige of racism'

House Minority Leader Todd Rutherford said Democrats were united behind the Senate bill, which would send the flag to the state's Confederate Relic Room — near the resting place for the final rebel flag that flew over the Statehouse dome until it was taken down in 2000.

Democrats didn't want any new flag going up because it "will be the new vestige of racism," Rutherford said.