Robin Williams was a supremely flexible performer. Although he made his name in comedy and became a beloved icon of family entertainment, Williams also had great talent as a dramatic performer -- especially when he would shift gears and play a villain. It's a shame then that he never got to play two of DC's most iconic bad guys, especially since he actually came very close to playing either of them.

During the development of both Batman and Batman Forever, Robin Williams was considered for the roles of Joker and Riddler. However, neither opportunity worked out for the actor, and one of them was actually a ploy to ensure Jack Nicholson appeared in the film. It's a real shame too, as Williams would have made a solid Riddler and might have been a fantastic Joker.

RELATED: Tim Burton's Batman Set up the Greatest Two-Face Movie Never Seen

How Robin Williams Almost Played Joker & Riddler (And Why He Didn't)

According to "Shadows of the Bat: The Cinematic Saga of the Dark Knight," a six-part documentary series included on the Batman: The Motion Picture Anthology home release, Robin Williams was an early and vocal contender for the role of Joker in Batman. While Warner Bros. wanted to cast Jack Nicholson in the role (and told Burton to focus on casting a "movie star" for the part), Williams did everything he could to get the role. When Nicholson initially appeared to pass on the project, Warner Bros. reportedly offered the role to Williams. But as explained by SlashFilm, this was really just a means of forcing Nicholson to make up his mind on taking the part or not. When Nicholson agreed to become the Joker, Warner Bros. rescinded their offer to Williams -- reportedly infuriating him.

However, Williams' seemingly made peace with the event, and expressed interest in appearing as the Riddler in a later entry in the series. This almost came to pass with Batman Forever, which featured Riddler and Two-Face as the film's central villains. The Riddler was written with Williams in mind, and reporting at the time suggested he was in contention with John Malkovich and Michael Jackson for the role. But Williams ultimately couldn't reach a deal with Warner Bros. and passed on the role, with Entertainment Weekly reporting at the time that Williams was concerned he'd be overshadowed by Tommy Lee Jones after he was cast as Two-Face. Riddler still appeared in the film and reportedly still carried over many of those elements written for Williams, but it was ultimately Jim Carey who played the character.

RELATED: Ben Affleck Won't Direct Batman for Gunn's New DC Universe - 'Absolutely Not'

Robin Williams Would Have Made A Great Batman Villain

Robin Williams is on the air in the film Good Morning, Vietnam

Williams is far from the only wild potential casting for the Batman films, with plenty of stars of the era being considered at various points for a number of different roles. Williams remains one of the most interesting though, especially given his later career choices. Less than a decade after the release of Batman Forever, Williams appeared in films like Insomnia (helmed by future Dark Knight Trilogy director Christopher Nolan) and One Hour Photo, which saw the performer channeling a far darker presence than what many of his comedic roles were known for. Williams' intensity in those two films feels very in-line with the Riddler who appeared in the gritty The Batman, but might not have been as good of a fit for the far more ridiculous and goofy Riddler who appears in Batman Forever.

Williams playing the Joker, however, remains one of the franchise's most intriguing what-ifs, as the character's wry jokes, artistic expression, and casual murderous side might have been amplified by Burton's bombastic approach to the Dark Knight. Jack Nicholson remains one of the best on-screen portrayals of the Joker. He's a magnetic but frightening charmer whose ability to shift from cold rage to casual indifference in a second makes him a real threat. But Williams might have quietly been a better fit for the part, playing the loud moments as expected but unveiling his more frightening acting chops far earlier than he did in real life. It's just a shame then that Williams never got the chance to become the Clown Prince of Crime, and was just a bargaining chip in someone else's casting.