When “Watchmen” star Yahya Abdul Mateen II was cast in the HBO show as Cal Abar, he had no idea he’d secretly landed the most important part.

“It was somewhere between the second or third episode when I found out,” Abdul-Mateen, 33, tells The Post. “I knew Cal had a ‘mysterious past,’ and I didn’t really have any hints as to what that would be. Then I had a conversation with [showrunner Damon Lindelof] when he let me know… I was very surprised and excited.”

For the first half of “Watchmen,” Cal seemed like an innocuous supporting character, a loving husband to Angela Abar (Regina King). But in a twist towards the end of the season, which concluded Sunday night, he was revealed to be the most crucial figure of all: the iconic Dr. Manhattan.

“Watchmen” — which HBO says is their most-watched new series since “Big Little Lies” — is based on the eponymous 1986 comic about masked vigilantes, though it’s set in 2019. Dr. Manhattan is its most famous face: a post-human “god” with blue skin who wears nothing but his birthday suit.

Abdul-Mateen, who is a rising star with several high profile movies coming up (most notably Jordan Peele’s “Candyman” and the fourth film in the “Matrix” franchise), was unfazed about that aspect, though he says the blue makeup took three hours to apply.

“I knew there was a possibility I’d be nude just because I was on HBO…so that was a very small part of the way I processed the character,” he says. “That was more liberating than anything: to play a character who wasn’t concerned about shame. I was happy with the way they handled it. It was never shot in a way that was objectifying. It was about him being comfortable in his body.”

In the show, Dr. Manhattan was assumed to be offscreen far away from the action — until the seventh episode revealed that he’s been there all along, disguised as Cal. After it aired, Abdul-Mateen posted a video of himself laughing on his Twitter.

“I felt like I got away with the biggest heist of the century,” he says. “I was in a taxi cab uptown on my way to watch the episode with my sisters. We do that every Sunday, and I was watching my Twitter feed. It was really hilarious to be on the inside of the joke, watching people tweet about it and seeing their reaction as they go on that emotional journey.”

The finale sees Dr. Manhattan at the center of the action, as white supremacist senator Joe Keene Jr. (James Wolk, “Mad Men”) and eccentric billionaire Lady Trieu (Hong Chau, “Big Little Lies”) both vie to harness his power for themselves. He’s killed, but he’s not alone, because his wife Angela is by his side.

“Love is sort of the universal theme. I’m really happy we were able to insert that and have that sneak up on the audience and have that be accepted just as well as everything else,” says Abdul-Mateen.

“We’re talking about American history and racial tension and trauma passed down through generations. It’s important to put this imagery out there — and also at the end of the day, we find out it’s really a love story at the same time.”

Of course, since he’s a supernatural character, Dr. Manhattan’s death could conceivably be impermanent if the show is renewed. When asked about that possibility, Abdul-Mateen says, “It’s been a pleasure playing the role. If my man gets called [for a potential Season 2], I’m down to pick up the phone if it rings.”

Ref;nypost.com