Robin Williams brought joy to countless people over the course of his career. However, before he had audiences laughing at films like Aladdin and Mrs. Doubtfire, or touched hearts with performances in Dead Poets Society and Good Will Hunting, he had his breakthrough role with a guest appearance on Happy Days

In February 1978, Williams played the oddball alien Mork from Ork in an episode of the hit sitcom. The role provided a showcase for his talents and was a key step on his way to stardom — but it took a series of twists and turns, and some desperation on the part of Happy Days producers, for Williams to get the opportunity in the first place.

READ MORE: Robin Williams' Non-Stop Mind Brought Joy to Millions. But for Him, It Brought Endless Pain

Garry Marshall's son came up with the idea to have an alien on 'Happy Days'

The movie Star Wars (later known as Star Wars: Episode IV – A New Hope) came out in 1977. Among the film's many fans was Garry Marshall's son, who asked his father why a spaceman couldn't also stop by Happy Days, the hit show Marshall had created. A visit from outer space didn't quite fit in with a sitcom that took place in Milwaukee, Wisconsin, in the 1950s, but Marshall decided to make his son happy.

The episode "My Favorite Orkan" was written for the fifth season of Happy Days. It featured Richie Cunningham, played by Ron Howard, Henry Winkler's always cool Fonzie and others on the show meeting inquisitive and uninhibited alien Mork from Ork. Mork traveled to Earth to take Richie back to his home planet as a specimen for further study. When Richie seeks help escaping his would-be abductor, a battle between the Fonz and Mork ensues (Richie later comes to believe the entire experience was a dream).

In a 2006 interview, Howard related that the network had disliked the episode and didn't want to produce it. Though Howard himself had appreciated the fantastical story idea, he admitted, "It was an episode that didn't read so great." Only Marshall's insistence made it possible to go ahead. Even then, the script continued to have its detractors. Anson Williams, who played Richie's friend Potsie on the show, told The Hollywood Reporter that it "was like the worst script in the history of Happy Days."

Robin Williams Mork Happy Days

Robin Williams

It was a tough search to find the right person to play Mork

Many actors seemed to agree with the negative take on the script's quality because it proved nearly impossible to find someone to play Mork. Some performers, like Dom DeLuise, were offered the part but turned it down. Another person was hired but quit, and the role was still uncast just a few days before the episode was scheduled to tape.

Stories vary as to how Williams came to the attention of Happy Days. Per Anson, Marshall's lack of success in finding an actor for Mork led to him ask the cast, "Does anyone know a funny Martian?" Al Molinaro, whose character Al Delvecchio ran the diner on Happy Days, suggested Williams, with whom he'd taken an improv class. This recommendation was backed up by Ronny Hallin, who was the show's casting director and Marshall's sister. 

In a version of the story told by Marshall, "Ronny told me about this funny guy, Robin, who performed on the street," he told Page Six. "People would put money in his hat." When Marshall was hesitant to bring in someone with this background, Hallin convinced him by saying, "The hat's pretty full!"

Whatever the means by which he first came to Marshall's attention, Williams was brought in for an audition and easily won the part. Marshall later explained to the Los Angeles Times, "I will never forget the day I met him and he stood on his head in my office chair and pretended to drink a glass of water using his finger like a straw." (Mork, being an alien, doesn't drink like a human, and instead of sitting in a standard earthly manner he inserts himself headfirst into chairs, a trait Williams displayed during this episode of Happy Days.)

READ MORE: Inside Robin Williams, Whoopi Goldberg and Billy Crystal's Unbreakable Bond

Henry Winkler Robin Williams Ron Howard Happy Days

(L-R): Henry Winkler as the Fonz, Williams as Mork and Ron Howard as Ritchie on "Happy Days"

The cast was blown away by Williams' performance

On Wednesday Williams came to the set of Happy Days. Taping was set to occur on Friday evening, and normally a guest star would have started rehearsing with the cast on Monday. Yet this late arrival didn't keep him from mesmerizing everyone around him with his talent. "He started improvising instantly," Howard later said of Williams' performance. "It was the most exhilarating thing." In 2015, Winkler revealed to The Guardian how he'd felt at the time: "I'm in the presence of greatness and my job here is to get out of his way."

Williams had attended Juilliard and been seen on TV in a revival of Laugh-In and The Richard Pryor Show, but nothing he'd done previously could match the reaction to his appearance on Happy Days. Marshall shared with People what took place once the show finished taping: "At the end of the episode, 300 people in the audience stood up and applauded, which is not usually done. It didn't take a genius to know he could do his own show." 

After the episode aired there was a deluge of fan mail for Williams. In September 1978, just a few months after Mork made his Happy Days debut, he was starring in the sitcom Mork & Mindy, in which his alien character carried out a new mission to explore life on Earth. That popular show ran for four seasons. Williams also stopped by Happy Days again for the episode "Mork Returns."

Williams, who died on August 11, 2014, left behind an impressive body of work. However, the opportunity to play Mork from Ork on Happy Days remains an important moment in his career. "You know, it's weird," Williams told ET Online. "Even after I won an Academy Award, it was a week later there were still people going, 'Mork!'"