Star Trek: The Next Generation saw its share of famous guest stars. Once it had established itself as the behemoth of primetime television that it was, The Next Generation boasted performances from stars like Kelsey Grammer and Kirsten Dunst, and even brought back Leonard Nimoy and James Doohan to reprise their The Original Series roles. One actor the show never snagged, however, was Robin Williams, despite the fact that an episode was written specifically for him and the actor's passion for the series.

The episode written for Robin Williams was Season 5, Episode 9, "A Matter of Time." The episode focuses on the time-traveler Berlinghoff Rasmussen, a 26th century historian who traveled back in time to observe Picard and the crew of the Enterprise during a crucial moment. Except Rasmussen didn't come from the future — he came from the past. He had stolen his time machine and was visiting The Next Generation's 24th century in order to steal as much technology as he could and become rich back in his own time.

RELATED: Star Trek: The Next Generation - Why Diana Muldaur's Katherine Pulaski Left After Season 2

Star Trek TNG Matter of Time Data

Rasmussen was written to be played by Robin Williams. While he was designed to be a nondescript white male in his 40s, it wasn't the character's appearance that made him memorable. Rasmussen's eccentric but positive demeanor played right to Williams' strengths, emphasizing witty lines and his relationships with the regular Star Trek crew.

Williams was already a household name when "A Matter of Time" was written. His iconic roles in living room staples like Mork & Mindy were tempered with his serious credits like Dead Poet's Society and Good Morning, Vietnam. While this episode would have predated some of the roles that are most frequently associated with him (Aladdin's Genie or the eponymous Mrs. Doubtfire), Williams would have been a well-known actor and a get for the show.

RELATED: Star Trek Theory: Picard Had a Secret Son - and People HATED Him

The timing was off, though. According to some sources, Williams turned down the role of Rasmussen in order to play Peter Pan in Steven Spielberg's Hook. Others claimed that he had finished filming Hook but that other commitments he was starting — including becoming a father — meant that the couldn't take on the role.

While Williams was the intended guest star for "A Matter of Time" and would have brought the perfect energy to the part, his replacement made the role his own. Matt Frewer, famous for his portrayal of Max Headroom, brought a smiling, conniving charm to Rasmussen that will forever be associated with the character.

Robin Williams never got to live out his Star Trek fanboy dreams, despite the willingness of the crew and writers to make a space for him on The Next Generation. While "A Matter of Time" could have been the perfect vehicle to bring Williams aboard the Enterprise, the resulting product was still a popular episode, even without his charm.

KEEP READING: Star Trek Confirms We'll Still Be Weebs in the 22nd Century