The South Carolina legislature passed a bill early Thursday to remove the Confederate battle flag from the state capitol grounds after an emotional 13-hour debate over the controversial banner.
The flag, which dates back to the 1861-65 American Civil War, is a symbol of slavery and racism for many, but for others, stands for Southern heritage.
The bill, already approved by the Senate, passed a third and final vote in the House of Representatives in the early hours of the morning by a margin of 94-20, and now goes to Governor Nikki Haley to be signed into law later in the day.
Haley has said she will sign it.
The bill was passed after three days of intense debate in both chambers with tempers fraying in the House late Wednesday. The final vote was secured almost exactly three weeks after nine black worshippers were gunned down on June 17 during Bible study at a church with an historically black congregation in Charleston.
The battle over the banner was stoked by photos of the accused shooter posing with a Confederate flag on a website bearing a racist manifesto.
The murders sparked a bipartisan wave of repudiation across the South, from politicians to businesses, led by Haley.
The bill appeared to be in trouble as the debate ran late into the night on Wednesday as Republicans launched dozens of amendments seeking to soften the impact of taking down the flag and move it to a museum.
"If you cannot be moved by the suffering of the people of Charleston you don't have a heart," said white Republican Representative Jenny Anderson Horne, turning her frustration on her own party members.
As the House debate began, the South Carolina Law Enforcement Division said it was investigating threats sent to legislators on both sides of the issue.
The debate was civil most of the day as conservative defenders of the flag introduced more than 60 amendments seeking to replace it with various alternatives, such as a different South Carolina battle flag from the period, or flying the current Confederate flag only once a year on Confederate Memorial Day.
Another amendment that almost passed sought to put the issue to a statewide referendum.
After one defeat Republican Representative Chris Corley, who is white and defended the flag, proposed substituting the banner with a white surrender flag, blasting his own party for failing to support him. "Maybe that will make everybody happy," he said.
Other Republicans criticized Haley for rushing the bill.
Earlier, Representative Wendell Gilliard, a black Democrat from Charleston, urged support for the bill as a tribute to the slain church members' families and their expression of forgiveness for the accused killer.
"This has brought forth a new understanding and new ways of seeing ways to peace and justice. ... The right thing to do is the gentle laying down of the past," Gilliard said.
The flag's dwindling defenders deny its association with slavery, saying it honors those who fought and died for the state and the southern Confederacy on the losing side of the Civil War.
House members who support the flag looked to history - and prayer - for answers.
"I grew up holding that flag in reverence because of the stories of my ancestors carrying that flag into battle," Representative Michael Pitts, a white Republican, told the House.
"I have wept over this thing. I have bathed this thing in prayer. I have called my pastor to pray for me," said Eric Bedingfield, a white Republican flag defender. "You can't erase history," he added.
The banner was originally raised atop the State House in 1961 - joining the state flag and the U.S. flag - in what was described as a commemoration of the centennial of the Civil War.
Others, however, saw it as a slap in the face to the black civil rights movement then gaining momentum.
In 2000, flag opponents scored a partial victory, getting it moved from atop the capitol to its place by the monument, only yards from the State House entrance.
The current bill's strong bipartisan backing marks a dramatic turnaround in sentiment from only a few months ago, largely attributed to a national wave of sympathy for the nine victims at Emanuel African Methodist Episcopal church in Charleston, about two hours drive southeast of the state capital Columbia.
The church pastor, Reverend Clementa Pinckney, was also a widely admired state senator.