After Rami Malek auditioned for Sam Esmail’s thriller series "Mr. Robot," he didn’t think he would land the lead part.

During Tribeca Film Festival’s “A Farewell to “Mr. Robot” conversation on Sunday, the Emmy-winner admitted that he thought the role of hacker Elliot Alderson would likely go to the “usual suspect” in Hollywood -- a white actor.

Malek, who is a first-generation American born to Egyptian immigrant parents, said that before working on “Mr. Robot” he “played a pharaoh in ‘Night of the Museum’ and I think a few terrorist roles.”

“At some point [I] put my foot down and said that’s going to be it for that,” he added. “That was a great decision because I would get offers of that nature and you constantly desire to work as an actor, but there are things you realize, well, that’s not worth it. I’m not representing myself or the community well.”

RAMI MALEK THANKS GIRLFRIEND LUCY BOYNTON, TALKS IMMIGRATION IN BEST ACTOR ACCEPTANCE SPEECH

Rami Malek attends Tribeca Talks A Farewell to Mr. Robot during the 2019 Tribeca Film Festival at Spring Studios on Sunday, April 28, 2019, in New York. (Photo by Andy Kropa/Invision/AP)

And because of the success of the USA drama, Malek was seen by producers who cast him as Freddie Mercury in “Bohemian Rhapsody” for which he picked up a lot of hardware this past awards season including the coveted Oscar for best actor.

Esmail said that “over 100” actors read for Elliot but Malek brought a vulnerability and emotional depth to the character that no one else did

RAMI MALEK RESPONDS TO THAT AWKWARD STAGE MOMENT WITH NICOLE KIDMAN AT THE GOLDEN GLOBES

The writer/director added this his casting process was colorblind and he was just looking for the “right person.”

As for the inspiration for Season 4, Esmail said he accidentally predicted the future with the show’s first season tagline (which debuted in 2015), “Our democracy has been hacked.”

“In the writer’s room [for Season 4], we’re continuing to let current events inspire us,” he continued, acknowledging the recent Mueller report and Russia's efforts to hack the 2016 presidential election weighed heavily on people’s mind in the brainstorming process.

RAMI MALEK BREAKS SILENCE ABOUT CONTINUED ALLEGATIONS OF SEXUAL ABUSE AGAINST BRYAN SINGER

“Mr. Robot”'s final season will premiere later this year and be “one very long Christmas special” in homage to British TV culture.