When lead actress Thuso Mbedu walked onto the set of “The Underground Railroad,” she often had to brace herself for what her character, the enslaved Cora, and those she loved were about to endure.

The 10-part Amazon series, out Friday and directed by Barry Jenkins from Colson Whitehead’s novel of the same name, contrasts the moral depravities of subjugation and slavery with the humanity, ingenuity and determination of enslaved people, exemplified by Cora. Everyone involved in the production understood “the weight of what we were doing,” Mbedu says.

Though the show has nuanced storytelling and outstanding cinematography, it perhaps most importantly was approached with deep wells of compassion by Jenkins. It follows the same basic plot as the book, a work of alternate historical fiction: the Underground Railroad is a literal series of trains run by Black people spiriting enslaved people toward freedom. Whitehead’s tome won the Pulitzer Prize in 2017, the same year that Jenkins’s “Moonlight” won the Oscar for best picture.

In video interviews late last month, the cast’s five main actors emphasized that it was the appeal of both the novel and Jenkins that drew them in.

“I read the book and the script, and both just blew my mind,” says Aaron Pierre, who plays Caesar, the enslaved man who leads Cora from a Georgia plantation to the Underground Railroad. “Colson is a master genius, and Barry is a master genius, and when you put them together it’s an eruption of genius.”

The tale does not shy away from White America’s distressingly endless capacity for hate and cruelty: It is all too visible on the plantation, in the warped experiments on Blacks that Cora encounters in South Carolina, the ruthless barbarity she finds in North Carolina, the vicious ambush she flees in Indiana. Those worlds often echo all-too-real moments in American horror, be it the government’s Tuskegee experiments or the 1921 Tulsa Race Massacre.

So while Mbedu always felt well cared for during filming — there was a guidance counselor on set “to bring me back to myself,” she says, and Jenkins himself “was always checking up on me” — the supportive cast and crew understood that putting on the chains and the burdens of being Black in antebellum America naturally took a toll.

“I had to have tricks, like moving through the set with my eyes downcast, so that when I opened my eyes I’d be experiencing everything only as Cora, because otherwise it would be too much for Thuso to take in,” Mbedu says.

The South African actress grew up in the immediate aftermath of apartheid and, like Cora, lost her parents at a young age. But she drew a sharp border between her life and Cora’s, relying on “a whole lot of research” to bring the character’s vocal, physical and psychological journey to life.

“The one time in the past where I made the mistake of trying to draw from my own experience, my brain went, ‘That was too traumatizing, we’re shutting down now.’ I can empathize, but I cannot personalize because it’s too traumatic to relive.”

Despite the series’ seemingly endless Black suffering, the cast made clear that it never indulged in “trauma porn,” for which the recent series “Them,” also from Amazon, was frequently castigated. (Amazon founder and CEO Jeff Bezos owns The Washington Post.) As unflinching as “Underground Railroad” is, the show is ultimately less about the torture of slavery and more about the quest for freedom in the face of endless obstacles. It never stops celebrating our potential for love and fortitude, seen in Cora and many of the Black men and women she encounters along the way, who are given more agency under Jenkins’s watch.

“The novel and the series celebrate the magnitude of strength these people had to have in order to overcome such devastating hardship,” says Pierre, adding that even Caesar, who suffers unspeakable brutality, triumphs in a way. “He embodies a sort of transcendence because he stays with Cora and lives on in spirit, encouraging her to pursue the liberation and freedom she desires.”

William Jackson Harper, who plays Royal, an Underground Railroad conductor who rescues and then falls for Cora, says the series is so intense that he had to pause while watching it because he was “more triggered than I thought I would be.”

Yet he found plenty to savor both as an actor and a viewer. “The part of the story I gravitate to is that capacity for resilience because that is the story of Black people in this country,” he says. He particularly relished the filming days that focused on “joy and hope and success, all the things we cling to to keep ourselves alive. I love that it was such a significant part of the story.”

Bringing to life the mixture of pain and loss with happiness and grace was a privilege but also a keenly felt obligation for the cast. “There’s so much in these scenes to unpack and understand, and what was written was so lovingly rendered,” Harper says. “I definitely did feel a responsibility — it’s fiction, but it is about being truthful to those moments and those circumstances.”

For Pierre, that meant conveying both Caesar’s determination to maintain his dignity and humanity, and a knowledge that Black men are aware that they can be perceived as dangerous. So while Caesar’s emotions vividly play across his face, he usually maintains a remarkable physical stillness. “You can be still and calm and have a volcano happening in your mind,” he says. “That’s what rang true for me.”

Jenkins expanded and changed the original story as he needed, adding characters, radically altering critical scenes and dramatically fleshing out the stories of both Ridgeway (Joel Edgerton), the slave catcher who pursues Cora with a vengeance, and Mabel (Sheila Atim), Cora’s mother, who years earlier ran away and vanished, leaving Ridgeway and Cora irate for very different reasons.

In Jenkins’s hands, Mabel, a midwife on the plantation, risks her own safety by angering those in power when she speaks up and defends other women who need more humane treatment after childbirth, before she finally breaks and runs away, leaving her young daughter behind. Atim discussed with Jenkins what the additions signified.

“Mabel encapsulates the internal struggle so many people were having,” Atim says. “She was bringing life into that world and wanted to do so safely whilst also recognizing that she’s still facilitating this system — which she’s a victim of . . . herself. She’s got so much on her shoulders and a real schism within her.”

Edgerton praised Jenkins’s more fully rounded depiction of Ridgeway — who embodies so many of the beliefs and behaviors of the Confederacy but also of imperial America in general — making him more than “just a combination of bad actions.”

An impulsive youth who is quick to anger, Jenkins’s version of Ridgeway feels judged by his father, Edgerton says, and since his father sees all people as equal, Ridgeway rebels and proves his manhood through violent bigotry.

“A person who is damaged and finds themselves in a position of power is a dangerous combination,” Edgerton says, underscoring the connection to modern times. “A lot of political cataclysm comes from people doubling down on things because of an unwillingness to say, ‘Maybe I was wrong.’ Those actions affect their lives but also the lives of all the people they come in contact with and cause a lot of damage for everyone else.”

For Cora, Jenkins expanded or added interactions with other characters, giving her both companionship and responsibility. Mbedu says that the changes shifted the equation for Cora, sometimes encouraging her to take action out of a sense of duty to people she cares for.

“Cora had chosen to put everybody at arm’s length after her mother leaving her behind, but now she realizes and embraces that she does not have to be alone on her journey,” Mbedu says of how Jenkins further enhanced the sense of Black communal commitment.

But the story also shows that Cora cannot permanently bear every burden and loss and still survive — that she must learn to grieve but also to live.

“This is a lesson for me that I am literally daily processing and talking myself through,” Mbedu says. “This story gives us a glimpse of what you can try to do as you forge your way forward.”