Here's how The Big Bang Theory managed to get Mark Hamill to cameo during its penultimate season. After cementing itself as one of the biggest comedy hits of the 2000s/2010s, The Big Bang Theory finally came to an end in 2019 after a whopping 12 seasons. As many detractors as Big Bang Theory had, there's no doubt that viewers still miss getting their new weekly dose of Leonard, Sheldon, Penny, and the gang. If nothing else, at least re-runs continue to air on a constant basis on TBS.

Over its 12 years on the air, The Big Bang Theory – playing into the main male characters being nerds – managed to land cameos and sometimes full-on guest roles from various giants of the sci-fi and fantasy genres. This included legends like Star Trek's William Shatner and George Takei, Star Wars' Carrie Fisher and James Earl Jones, and Back to the Future's Christopher Lloyd. Perhaps their biggest get ever came near the end, though, when Mark Hamill appeared during season 11.

Related: Every Sci-Fi Icon Who Guest Starred On The Big Bang Theory

Through Big Bang Theory's usual wacky shenanigans, Hamill ended up officiating the marriage ceremony of Sheldon and Amy in season 11's finale, titled "The Bow Tie Asymmetry." As one might imagine, Sheldon is quite thrilled by this turn of events, being a massive Star Wars fan. Behind the scenes, though, Hamill's cameo came about fairly simply. Showrunner Steve Holland reached out to Hamill and asked him to take part, and he accepted the invite.

Mark Hamill on The Big Bang Theory Officiating Wedding

As shared (via THR), Big Bang Theory showrunner Steve Holland – himself a huge Star Wars fan – saw the episode with Sheldon and Amy getting married as an opportunity to finally make a Hamill cameo on the show happen. Interestingly, the script for the episode actually hadn't been written yet. Granted, when Holland and his fellow producers contacted Hamill, the legendary portrayer of Luke Skywalker signed on even without knowledge of what he'd be doing.

Holland says Hamill was a bit nervous about committing without a script in hand, but after a meeting with the writing staff, the actor decided to trust they knew what they were doing. One assumes that the massive popularity of The Big Bang Theory also helped make Hamill's decision to take part in the season 11 finale a little easier. Having Hamill officiate Sheldon and Amy's wedding was an inspired choice, and naming Hamill's dog in-universe "Bark Hamill" was a simple but hilarious bit of wordplay. Hamill usurping fellow sci-fi star - and Sheldon's recurring frenemy - Wil Wheaton out of the role of officiant also made for a great moment. Hamill ended up being the perfect guest star for one of The Big Bang Theory's most memorable episodes, and it all started him making a creative leap of faith.

More: Jim Parsons' Exit Saved The Big Bang Theory From Destroying Itself