The gurney in the execution chamber at the Oklahoma State Penitentiary in McAlester, Okla.  (Sue Ogrocki/AP)
Daniel LaChance is Andrew W. Mellon faculty fellow in law and the humanities at Emory University and the author of "Executing Freedom: The Cultural Life of Capital Punishment in the United States."

In a not-too-distant future, a black death row inmate named Clayton Leigh cuts a deal with a white entrepreneur. In exchange for a financial payout to his family, the condemned man agrees to have his mind uploaded to a computer at the moment of his execution.

The businessman then makes Clayton’s consciousness the centerpiece of a carnivallike attraction he operates: the “Black Museum.” There, he resurrects Clayton as a sentient holograph — capable of thinking, feeling and speaking — and puts him in an electric chair. Visitors to the exhibit can be reminded of his crime, the killing of a white woman, before becoming his executioner, pulling a lever and watching as Clayton writhes in pain. A machine then dispenses a souvenir of the experience: a key chain-size screen with a copy of Clayton suffering endlessly as electricity courses through his consciousness.

That is the twisted setup of the season finale of the latest installment of the Netflix television series “Black Mirror.” Gruesome as it is, “Black Museum” breaks new ground in representations of the death penalty in American popular culture. By presenting an execution as a literal high-tech lynching, the episode connects capital punishment and the history of white pleasure in black pain.

Executions were once public events in the United States, spectacles that could draw thousands of spectators. They were intended to instill obedience in those who attended them, reminding them of the consequences that awaited those who strayed from the law.

In the 19th century, though, authorities gradually became convinced that execution audiences often showed up not to condemn sin, but to be entertained by the suffering of others. Beginning in the Northeast in the 1830s and spreading gradually across the nation, legislatures removed executions from the public square, moving them into jail yards and, eventually, into the bowels of prisons.

Except in the South. Public executions there lasted well into the 20th century in many places. Why? Because public lethal punishment of African Americans had become an occasion for white community building.

In the late 19th and early 20th centuries, white Southerners continued to wrestle with the insecurities created by their defeat in the Civil War. The emancipation of African Americans and their brief, Reconstruction-era participation in political governance had undermined white Southerners’ sense of control over society. Jim Crow laws could never completely restore it.

Working-class whites saw a free African American labor force as a threat to their livelihood. Their fears reflected and amplified accounts of black crime shared by whites of all social classes. The most pernicious of those narratives — that of licentious black men raping innocent white women — captured many white people’s sense of themselves as a virtuous, vulnerable people being ravaged by an animallike people not fit for freedom.

In that context, violent lynching spectacles momentarily turned back the clock to the antebellum era, when African Americans were property, denied civic standing and excluded from public life. Photographs circulated of white men standing next to black bodies after lynchings as if they were hunters proudly displaying newly killed wildlife. Torn pieces of clothing, a shard of finger bone, a frayed bit of rope — the circulation of these tokens recalled a past in which African Americans themselves were circulated as property.

For Southern officials trying to quell the region’s lynching epidemic, public executions offered a more orderly alternative that satisfied the same needs. As historian Amy Louise Wood has shown, while executions avoided the grotesque excesses of lynching, they offered whites a similar spectacle of black suffering. “Flying jennies and fake shows were side attractions” at one man’s 1893 execution in Georgia, a newspaper cheerfully reported. Vendors sold soda and snacks at the double execution of two black men in Mississippi in 1915. Many brought their lunch, “making it a picnic,” as one reporter wrote.

Today, African Americans are still overrepresented in the nation’s execution chambers. Although they make up 12 percent of the U.S. population, they represent 34 percent of those executed since the 1970s. Social scientific research continues to demonstrate the role that racism plays in the administration of the death penalty.

Hollywood, though, has long projected a vision of the death penalty as colorblind. As executions surged in the 1990s, films sometimes seemed actively aimed at whitewashing the death penalty. In “Dead Man Walking” (1995) and “The Chamber” (1996), Sean Penn and Gene Hackman played unrepentant, white racists whose impending executions trigger a moral awakening. Rather than portraying the death penalty as a tool of white supremacy, the films suggested that preparing for their executions helped them take responsibility for their crimes and shed their racial hate.

“The Green Mile” (1999) — the highest grossing death-penalty movie of all time — took on the question of capital punishment’s racist past, only to soften its impact. In that film, Michael Clarke Duncan played John Coffey, a condemned black man wrongly convicted of killing two little white girls in 1930s Louisiana. Coffey is a magical Christ-figure who has long taken on the burden of white people’s pain and sin and hate. His on-screen electrocution is depicted as a welcomed relief from anti-black racism, rather than an expression of it.

“Black Museum” is different. The show’s depiction of a black man put to death for killing a “cute” white woman forces a confrontation with the harsh realities of how race still plagues the death penalty. Like the very real instance when in 1998 a white juror in Georgia used the n-word to describe an African American man he had voted to put to death, adding that he had sometimes wondered whether African Americans “even had souls.” Or an expert witness in Texas who told jurors in 1995 that the defendant’s black race made him more likely than inmates of other races to be violent.

In the very name of Clayton Leigh, we can recognize a reference to Clayton Lockett, an African American whose execution by injection was severely botched in 2014, when Oklahoma officials failed to realize that the execution needle had slipped out of his femoral vein and was delivering the lethal chemicals into the surrounding tissue. He died “slowly and in apparent agony” as officials tried to abort the execution. Some took barely concealed pleasure in the screw-up. “If there is ever somebody who deserved it, it was him,” Lockett’s prosecutor remarked.

And in the glee that visitors to the Black Museum take in pulling the switch themselves, we can see parallels to the comments that readers often leave on online news coverage of executions. “Who’s next? Sharpen that needle,” one such comment read in response to the Cleveland Plain Dealer’s online coverage of Marvallous Keene’s 2009 execution.

Despite these parallels, our contemporary death penalty is not, of course, the dystopian spectacle depicted in “Black Museum.” The low-tech punitive spectacles of a century ago have been replaced by somber bureaucratic affairs. But “Black Mirror” suggests that the white rage that executions once showcased has not gone anywhere. It lingers on, still shaping the American death penalty in subtle — and occasionally not-so-subtle — ways.