Note: This story contains spoilers for Sunday night’s episode of “Watchmen.”

Before the shocking reveal of the true identity of “Watchmen’s” Hooded Justice — the masked vigilante who has served as an inspirational nucleus for that entire comic-book universe — showrunner Damon Lindelof first had to determine if the original graphic novel could even support his twist.

Lindelof, as well as his writers and producers, crafted the unveiling of Hooded Justice’s secret origin as the big-bang moment on their HBO retelling, which is based on the holy grail of comic books by Alan Moore and Dave Gibbons. They knew that Will Reeves, the centenarian played by Louis Gossett Jr., would have to be the man under the hood.

Will’s secret was revealed in Sunday’s sixth episode through his granddaughter, Angela Abar/Sister Night (Regina King). Angela, like Will once did, works in law enforcement and vigilantism, and also does her best work with a hood on. She ingests Will’s memories in pill form and goes into shock while reliving his past.

But if “Watchmen’s” written history was going to be reworked for television to say that its first superhero in the 1930s was a black man in secret, there would have to be an explanation for why the comics provided visual evidence that made it seem as though he was white.

Only one page in the entirety of “Watchmen’s” 12-issue story could be used as fuel for any potential Hooded Justice deniers in the wake of the series’ bombshell: In the second issue, on the seventh page in the seventh panel of Gibbons’s famous nine-panel page layouts, is a close-up shot of the superhero. It’s the one time you’re close enough to see skin beneath the eye holes of his mask.

The skin is white.

“We obsessed on that panel and we were like, ‘He’s a white man,’” Lindelof said in an interview with The Washington Post. “So [we had to] account for how this panel exists.”

They considered casting a light-skinned black male who could match the hue of the Hooded Justice in the comics, but the solution, simply enough, would be makeup.

Lindelof and his team decided that Hooded Justice, played in the episode’s flashback scenes by Jovan Adepo, would change his skin color with a few globs of pale flesh-colored makeup, forming a partial mask over his black skin. The mask under the mask served as a gateway to vigilante privilege that Lindelof says no black person would have been afforded in the real world — or the world of early 20th-century “Watchmen.”

“I’ve always wondered, for 30 years, not just who was Hooded Justice, but why didn’t they reveal his identity?” Lindelof said. “All the other Minute Men are on a first-name basis [in the comics]. [The other heroes] call Comedian, Eddie; Captain Metropolis, Nelson; and Mothman, Byron — but they don’t even know what Hooded Justice’s first name is. That means he never took off his mask. And I asked myself, why? What was he hiding? And the answer just seemed ….he was a black man. Because in 1938, if you were a black man who was a vigilante, if anyone knew you were black, they wouldn’t consider you a hero. They would murder you in the street.”

Lindelof’s new spin on “Watchmen’s” beginnings is a story of superhero appropriation. If Hooded Justice was the collard greens that kept his city strong and safe, the heroes that followed in his wake were a kale smoothie on its way to yoga class.

“[Hooded Justice] locked in with what I think is the great cultural idea of the last 400 years in our country, which is that people of color come up with incredible ideas and then white people appropriate them,” Lindelof said. “It doesn’t mean that white people don’t also sometimes come up with great ideas. But I think that the idea that costuming, vigilantism and superhero-ing, [that] the very first, the alpha, was a person of color and they had to hide their race, and then all these white people started doing it, too — that just felt like the American story.”

Cord Jefferson, who co-wrote Sunday’s “Watchmen” episode with Lindelof, describes Hooded Justice as a man of many masks: Secretly black. Secretly a vigilante. Secretly gay. One thing Jefferson says the writers knew he wouldn’t be was a billionaire playboy in the image of Batman. Other than wealthy genius Ozymandias killing millions to save billions in the original “Watchmen” tale, a man with the world at his disposal in this new imagining seemed the least likely to be interested in saving it.

“The idea that put-upon white guys are the ones who would invent superhero identities and be the ones seeking justice outside of the courts is kind of absurd when you think about it,” Jefferson told The Post. “They’re the ones for whom all those courts are working. The first person who would want to don a mask and a cape and go out seeking justice in a different way that was satisfactory to them, it makes total sense that it’s a person of color.”

Lindelof always knew HBO’s revival was going to be about race. The original comics didn’t shy away from social reality and neither would his series. He told himself that if Moore and Gibbons put a cape and mask on the Cold War, his “Watchmen” would do the same with the racism that seemed to have reawakened in America. Moments such as the deadly Unite the Right rally in Charlottesville, the Black Lives Matter movement against police brutality and the election of Donald Trump helped cement his decision to create new heroes and villains who would have to confront America’s history of racial prejudice and violence, both past and present.

That meant mixing real-life events with superhero fantasy as evidenced in the pilot episode. Will’s parents are forced to abandon him as a young child and send him somewhere safe during the Tulsa race riot of 1921 — which is a Superman like-origin story, mirroring the destruction of Krypton. Sunday’s Hooded Justice reveal included a hanging, death by dragging and racially abusive language. Stephen Williams, who directed the sixth episode, said certain scenes took an emotional toll on the cast.

“It felt like we were all on a mission,” said Williams, a native of Jamaica who told The Post that the irony of filming “Watchmen” in the Deep South (Georgia, specifically) was not lost on anyone. “There is a moment that involves a very, very ugly part of the history of mistreatment of African Americans in [America] that we filmed our version of. And that left us all literally holding each other up while tears were streaming down our faces on set. And it was just an example of the level of commitment that we all tried to bring to executing this episode.”

HBO’s new “Watchmen” series is set in Tulsa. That move might seem unexpected, unless you know Oklahoma’s troubled history of racial violence. (The Washington Post)

It’s an episode that Lindelof hopes doesn’t come off as trying to trick its viewers. He was delighted to see fans speculate correctly online that Will was indeed Hooded Justice, because it meant certain flags to the audience — Reeve’s red blazer and purple hoodie seeming like a deconstructed version of Hooded Justice’s superhero suit, or Will’s childhood fascination with Bass Reeves, a hooded avenger of the law — didn’t go unnoticed.

“We gave the audience clues to figure it out themselves,” Lindelof said. “I think if we just sprung it on them in episode six with no chance of guessing it, then we weren’t playing fair with our storytelling.”

Read more: