COLUMBIA, S.C. - South Carolina, the first state to secede from the union, dispatched with a lasting symbol of the Civil War on Thursday as Gov. Nikki R. Haley signed a law removing the Confederate battle flag from the grounds of the State House.

The flag, which flies in front of the graceful 19th-century capitol building here, is set to come down at 10 a.m. Friday.

Haley, a Republican, signed the bill in a capitol building surrounded by cheering lawmakers. She used nine pens to be given to the families of the nine victims of the Charleston church shooting on June 17, describing them as “nine amazing people that forever changed South Carolina’s history.”

She also praised lawmakers, including members of the House of Representatives, who engaged in a 13-hour legislative argument over the flag, voting at 1 a.m. Thursday to remove it.

“The Confederate flag is coming off the grounds of the South Carolina State House,” Haley declared. She added that it would be lowered with “dignity” while noting that the decision was the product of shared pain over the Charleston shooting, and admiration for the acts of those in the historic black church who welcomed a white man into their midst, only to see him shoot and kill.

“The actions that took place are what will go down in the history books,” Haley said. “Nine people took in someone that did not look like them or act like them, and with true love and true faith and true acceptance, they sat and prayed with him for an hour.”

For Haley, the removal of the flag represents a swift reversal from her long-standing views. The governor, who was re-elected last year, had long supported the compromise that allowed the flag to fly at the State House, but on June 22, less than a week after the massacre in Charleston, she demanded that it come down. Lawmakers in the Republican-controlled Legislature quickly obliged.

A bill to take down the flag passed the South Carolina Senate on Tuesday. On Wednesday, The House of Representatives spent hours discussing the flag, which was introduced on capitol grounds by white lawmakers in the early 1960s at the height of anti-integration sentiment.

The final vote in the House, 94-20, was well above the two-thirds’ majority required to move the bill to the governor, but approval arrived after midnight, and after a series of proposed amendments that would have delayed the flag’s removal.

Rep. Christopher A. Corley, R-Aiken County, called the debate over removing the flag “the most emotional issue our state will ever deal with.”

Josh Earnest, the White House spokesman, praised the decision to remove the Confederate battle flag as “progress,” while the Sons of Confederate Veterans on Thursday sharply criticized the plan.

“The Sons of Confederate Veterans is dismayed that the politicians of the great state of South Carolina have traded their integrity for the fleeting benefit of appeasing those individuals and groups who do not let facts stand in the way of their objectives,” Charles Kelly Barrow, the group’s commander in chief, said in a statement.

The decision to remove the flag, Barrow said, “evidences a capitulation to the malicious campaign that has fanned the flames of divisiveness for the sole purpose of political gain. It is a politically convenient insult to the legacy of millions of South Carolinians.”

Barrow also said that his members would continue to resist “the wave of cultural cleansing and political correctness that sullies” the names of their Confederate ancestors.

“No political act can erase the memory of these brave and good men,” he said. “And as this particular flag comes down, thousands more are being lifted, for the St. Andrew’s Cross stands not for hate, but for love.”

Around the flag on the State House grounds Thursday, there was a buzz of conflicting emotions. Anti-flag protesters were there, as they had been in recent days, but now their signs, instead of calling for removal, shouted messages of relief.

“IT IS A BEAUTIFUL DAY IN SC,” one sign read - an echo of the happy-talk catch phrase that Haley insists state workers use when they answer the phone.

Not everyone, though, was happy. Michael French, 43, a contractor who lives outside Columbia, came with his son Chandler, 17, to take a picture of the flag before it came down.

“Biblically speaking, any time there’s something that causes division among men, it should be done away with,” said French, who is white. “But I don’t think that applies here, because there will always be something else” - that is, something else for protesters to protest about.

Next, “they’re going to want to take down the Confederate monument,” his son predicted. “Everybody wants to be a victim.”

Still, here in an area of the city rich with Southern memorabilia and moodiness, from blooming pink flowers to the towering Confederate monument topped with an armed soldier, visitors of all kinds - black and white, pro- and anti-flag - seemed compelled to gather and reflect in relative peace.

As drivers passing by honked in support or shouted obscenities, some people waved small American flags. Many took selfies near the Confederate flag.

An older white man with a cane posed by the flagpole, solemnly, as another man took his photo. Both declined to comment.

Tamela Stevenson, 49, who is black, posed with her children, too, wearing a big smile. She said her grandmother Annie Mae Robinson had always told her that the flag would never come down in Robinson’s lifetime. She was right: She died 23 years ago.

“This just marks the beginning of South Carolina going forward and being with the rest of the world,” Stevenson said. “I know it won’t change everything, like the way people feel. But going forward, in the future, I think it will help.”