Wednesday’s horrific murder of nine people worshipping at Charleston’s Emanuel African Methodist Episcopal Church replayed a central theme in American history. It is the question, fought for centuries with both words and weapons: to whom does this country belong?

The alleged gunman, twenty-one year old white man Dylann Roof, killed six women and three men, including pastor Clementa Pinckney, who was also a South Carolina state senator. A witness to the shooting reported that the killer said: “I have to do it. You rape our women and you’re taking over our country. And you have to go.”

That a white terrorist murdered an African-American politician and African-American bystanders in a black church, using language straight out of Reconstruction, is not an accident. It reflects the vital intersection of American politics, race, and religion since 1866.

In the wake of the Civil War, white southern Democrats initially refused to face the reality that they would have to share any sort of economic, political, or social power with their former slaves. With the encouragement of President Andrew Johnson, who had taken over from the slain President Abraham Lincoln during Congress’s long summer recess, white legislatures in the South ratified the Thirteenth Amendment abolishing slavery, but then promptly set about recreating the conditions of servitude.

In most states, black people could not congregate, had to sign year-long work contracts, and could be arrested on charges of “vagrancy,” fined, and then bound to whoever paid their fine. Nowhere could a black person testify in court against a white person, so nowhere could a black American claim the protection of the law against theft, rape, or murder.

When Congress reconvened in December 1865, congressmen refused to return their black wartime allies to quasi-slavery under the very men who had spent four years trying to destroy the Union. They put forward the Fourteenth Amendment to give black men a civic identity that would give them legal rights as a condition for the readmission of the southern states to the Union.

When southern whites retorted that they would rather remain under military rule than submit to black equality, northern congressmen passed the Military Reconstruction Act of 1867, which called for new southern state constitutional conventions to rewrite state constitutions providing for black civic rights before the states could be readmitted to the Union. Crucially, the Military Reconstruction Act permitted African-American men to vote.

White southern Democrats recoiled at the idea of sharing political rights with black men. But African Americans and white southern Republicans, who had supported the Union during the war, recognized the power of their position. Republicans across the South began to organize black voters. One of their most common venues for political organization was among the very powerful black churches, especially the African Methodist Episcopal Church, and many of the early leading black politicians were clergymen.

At first, white Democrats stood against the political awakening of southern African Americans by simply refusing to enroll voters. This prompted Congress to put the military in charge of voter registration.

When both white and black Republicans registered to vote and elected moderate constitutional conventions, white Democrats organized a new force to stop their political opponents from taking over their states: the Ku Klux Klan. Before the 1868 elections, members of the Ku Klux Klan murdered at least a thousand African Americans and their white allies. In South Carolina, they killed African-American clergyman and state legislator B. F. Randolph at a train depot in broad daylight.

Congress stood against Klan terrorism with an 1871 law making their political intimidation a federal offense, a distinction that enabled President Grant to stop the depredations of the Ku Klux Klan by imposing martial law in parts of the South and by having federal courts, rather than local courts, try offenders.

For the next twenty years, white southerners controlled black political voices by finding ways either to work with black voters or to silence them. This was imperative, they insisted, for black voters were only interested in social welfare legislation that would cost tax dollars and thus “corrupt” the American government.

In 1889, the threat of a new Republican administration to mount a federal defense of black voting brought a new construction to the idea of the corruption of government. A new generation of white Democrats worried far less about political than about social issues. They insisted that black men must not vote because if they voted, they would take local political offices. This would give them patronage power, for in the nineteenth century, local positions depended on the goodwill of local politicians.

Black men would, for example, become school principals. There, they would use their power to hire teachers to force young innocent white girls to have sex with them in exchange for jobs. This political exchange very quickly turned to the idea that black political power meant widespread rape. By the early twentieth century, lynching black men was almost a civic duty for white citizens: only by purging the government of black voices could the nation be made safe.

When Roof said, “I have to do it. You rape our women and you’re taking over our country. And you have to go,” he was echoing the fear of black political power laid down in the aftermath of the Civil War, when white American men had to face the reality that this nation is, in fact, made up of far more women and people of color than it is of white men. That fact inspired terror — and terrorism — among white men in the late nineteenth century.

It did so again after 1954, when Brown v. Boardwarned white Americans that they would again have to share their country with African Americans. Then, as in the late nineteenth century, white Americans turned to terrorism against black political voices as, for example, when four Ku Klux Klan members bombed the Sixteenth Street Baptist Church in Birmingham, Alabama, and murdered four little girls.