This was accomplished through a reign of terror dedicated to winning "The Lost Cause" and putting the Negro, as the whites saw it, back in his place.
After a series of atrocities on the ground, matched by cynical politics in Washington, slavery eventually was replaced by its almost equally evil cousin, Jim Crow.
The key to its power, for a century or more afterward, was the disenfranchisement of black voters — which is why the issue of voting rights, and efforts to obstruct them, is so critical now in a United States where the mind of the South, or the bigoted part of it in any case, seems to have infected the heart of America.
This is from an article in The Smithsonian magazine:
“The bloodiest single instance of racial carnage in the Reconstruction era, the Colfax massacre taught many lessons, including the lengths to which some opponents of Reconstruction would go to regain their accustomed authority,” historian Eric Foner writes in Reconstruction: America's Unfinished Revolution, 1863–1877. “Among blacks in Louisiana, the incident was long remembered as proof that in any large confrontation, they stood at a fatal disadvantage.”
While the massacre made headlines across the country and 97 members of the white mob were indicted, in the end only nine men were charged of violating the Enforcement Acts of 1870 and 1871, sometimes known as the Klu Klux Klan Acts, intended to guarantee the rights of freedmen under the 14th and 15th Amendments. Lawyers for the victims believed that they had a better chance of bringing the ringleaders to justice in a federal court citing conspiracy convictions, instead of charging them with murder, which would have been tried in the heavily Democratic state courts. But the plan backfired. The defendants appealed, and when the case eventually came before the Supreme Court in 1876, the justices overturned the lower courts’ convictions, ruling that the Enforcement Acts applied only to actions by the state, not by individuals, Decker writes.
This ruling essentially neutered the federal government’s ability to prosecute hate crimes committed against African-Americans. Without the threat of being tried for treason in federal court, white supremacists now only had to look for legal loopholes and corrupt officials to continue targeting their victims, Gates reports. Meanwhile, principles of segregation were beginning to work their ways into law, with Plessy v. Ferguson officially codifying “separate but equal” just 20 years later.