South Carolina Gov. Nikki Haley signed a bill into law Thursday that will bring down the Confederate flag outside the Statehouse, a move that seemed unthinkable only a month ago in this Deep South state that was the first to secede from the Union.

The law requires the battle flag to be gone within 24 hours; her staff said it would be removed during a ceremony at 10 a.m. Friday and relegated to the state's Confederate Relic Room.

"The Confederate flag is coming off the grounds of the South Carolina Statehouse," Haley said. "We will bring it down with dignity and we will make sure it is stored in its rightful place."

The flag first flew over the Statehouse dome in 1961 to mark the 100th anniversary of the Civil War and was kept there as a symbol of official opposition to the civil rights movement. Mass protests decades later led to a compromise in 2000 with lawmakers who insisted that the flag symbolized Southern heritage and state's rights.

They agreed then to move it to a 30-foot pole next to a Confederate monument out front. But even from that lower perch, the historic but divisive symbol remained clearly visible in the center of town, and flag supporters remained a powerful bloc in the state.

More On This...

The massacre 22 days ago of nine people inside their historic black church in Charleston suddenly changed this dynamic, not only in South Carolina but around the nation.

Police said the shootings inside the Emanuel African Methodist Episcopal Church were racially motivated, and 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, re-ignited a debate over the flag's history as a symbol of white superiority and racial oppression.

Haley moved first, calling on South Carolina lawmakers to vote the flag down, and very quickly thereafter, other Republican lawmakers who have long cultivated the votes of Confederate flag supporters were announcing that other Civil War symbols no longer deserve places of honor.

"These nine pens are going to the families of the Emanuel Nine," Haley said after signing the bill into law. "Nine amazing individuals who have forever changed South Carolina history."

South Carolina's flag removal bill passed easily in the Senate, where state Sen. Clementa Pinckney, the pastor gunned down at the church, had served, but was stalled by debate in the House as dozens of amendments were proposed. Any changes to the Senate bill could have delayed the flag's removal by weeks or months, perhaps blunting momentum that has grown since the massacre.

House members deliberated well into the night, amid anger, tears and shared memories of Civil War ancestors.

Supporters of the flag talked about grandparents passing down family treasures. Some lamented that the flag had been "hijacked" or "abducted" by racists.

Rep. Mike Pitts recalled playing with a Confederate ancestor's cavalry sword while growing up. He said that for him, the flag is a reminder of how many dirt-poor Southern farmers fought Yankees, not because they hated blacks or sought to preserve white supremacy, but because their land was being invaded.

Black Democrats, frustrated at being asked to honor the Civil War soldiers who also fought to preserve slavery, offered their own family histories as a counterpoint. Rep. Joe Neal talked about tracing his ancestry back to four brothers who were brought to America in chains. A slave owner named Neal bought them, changed their last names and pulled them apart from their families.

"The whole world is asking, is South Carolina really going to change, or will it hold to an ugly tradition of prejudice and discrimination and hide behind heritage as an excuse for it?" Neal said.

Rep. Jenny Horne, a white Republican who said she is a descendent of Confederate President Jefferson Davis, scolded her party members for stalling.

"I cannot believe that we do not have the heart in this body to do something meaningful such as take a symbol of hate off these grounds on Friday. And if any of you vote to amend, you are ensuring that this flag will fly beyond Friday. And 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!" Horne screamed into the microphone.

The bill ultimately passed 93-27 in the House -- well above the two-thirds supermajority needed to make changes to the state's "heritage" symbols. Some lawmakers hugged, cried and high-fived, while others snapped selfies and pumped their fists.