COLUMBIA — More than 50 years after South Carolina raised a Confederate flag at its Statehouse to protest the civil rights movement, the state is getting ready to remove the rebel banner.

A bill taking down the flag and its flagpole from the Capitol’s front lawn passed the South Carolina House early Thursday after 13 hours of debate. It should get to Gov. Nikki Haley before the end of the day and she has promised to sign it quickly.

The bill requires the flag be taken down within 24 hours of her signing and shipped to the Confederate Relic Room.

There were hugs, tears and high fives in the House chamber after the vote. Members who waited decades to see this day snapped selfies and pumped their fists.

But even among the celebrations, there was more than a bit of sadness.

After the Civil War, the flag was first flown over the dome of South Carolina’s Capitol in 1961 to celebrate the 100th anniversary of the war. It stayed as a protest to the Civil Rights movement that sought to end discrimination against blacks, only moving in 2000 from the dome to its current location.

The push to remove the flag only started after nine black churchgoers, including state Sen. Clementa Pinckney, were gunned down during Bible study at the historic Emanuel African Episcopal Church in Charleston on June 17. Police said the white gunman’s motivation was racial hatred. Then three days later, photos surfaced of the suspect, Dylann Roof, holding Confederate flags.

“I am 44 years old. I never thought I’d see this moment. I stand with people who never thought they would see this as well,” said House Minority Leader Todd Rutherford, who called the victims martyrs.

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.

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 Pinckney’s funeral and his widow, who was hiding with one of their daughters in a church office as the gunman fired dozens of shots.

“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.

Opponents of removing the flag lamented that the flag had been “hijacked” by racists.

Rep. Mike Pitts, who remembered playing with a Confederate ancestor’s cavalry sword while growing up, said for him the flag is a reminder of how dirt-poor Southern farmers fought Yankees not because they hated blacks or supported slavery, but because their land was being invaded.

Black lawmakers told their own stories. Rep. Joe Neal talked about tracing his family back to four brothers, brought to America in chains to be bought by a slave owner named Neal who 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?” Neal said.

The governor issued her own statement. “It is a new day in South Carolina, a day we can all be proud of, a day that truly brings us all together as we continue to heal, as one people and on,” she said.