Jack Black and Jessica Alba made guest appearances in The Office season 5, but their cameos came in the form of a unique situation. The NBC sitcom, which ran from 2005 to 2013, hosted visits from several notable actors during its tenure. Black and Alba's cameos, however, stood out from the rest considering the circumstances surrounding their presence. The pair appeared in 2009's "Stress Relief," a two-parter directed by Jeffrey Blitz and written by Paul Lieberstein, who played Toby Flenderson in the series. Here's the Jack Black The Office cameo explained.

"Stress Relief" began with the memorable, yet chaotic, cold open that featured Dwight testing his co-workers' fire safety preparedness, resulting in Stanley's heart attack. Aside from the fallout from Dwight's stunt, Pam was dealing with the tension among her parent's marriage. To cheer her up, Jim asked if they could watch a bootleg movie on Andy's laptop. The movie was Mrs. Albert Hannaday, which starred Jack Black and Jessica Alba as Sam and Sophie, an engaged couple. While Sophie introduced Sam to her grandmother Lily, played by Cloris Leachman, he fell deeply in love with the elderly woman. Scenes from the love-triangle movie continued to interweave with Pam's struggle throughout the episode.

Related: The Office: The Hilarious True Story That Inspired “Koi Pond”

The stakes were high for the two-part episode considering it served as the follow-up program to Super Bowl XLIII. At the request of NBC, creator Greg Daniels needed to develop a standalone type of episode that would welcome new viewers while satisfying existing fans of The Office. The sitcom was already a major success for the network, but all parties acknowledged that big celebrity names draw greater attention. According to The Office: The Untold Story of the Greatest Sitcom of the 2000s, an oral history written by Andy Greene, names like Ben Affleck and Matt Damon were thrown around. Granted, the guest appearances had to fit with the blue-collar Scranton setting, so the series developed a fake movie with the Jack Black The Office cameo as well as Jessica Alba's appearance.

The "Stress Relief" Guest Stars Purposely Didn't Interact With Office Characters

The Office

At no point did Black, Alba, or Leachman directly interact with core characters from The Office. This was a calculated decision by Daniels and his crew in an effort to feature popular names without distracting from the small paper company. By creating a fake movie with the Jack Black The Office cameo, the celebrities were able to play a version of themselves as a way to attract a new segment of the audience. In doing so, it kept the primary subplots grounded in realism.

The crew of The Office shared in Greene's novel about how odd it was to film the Mrs. Albert Hannaday scenes (which isn't the only fake movie on The Office since Threat Level Midnight) since the tone was so different from what they were used to. Blitz shared that some early drafts of the fake movie featured a martial arts element, but that particular idea was abandoned. He did reveal that Leachman was very excited for her scenes, particularly when it came to making out with Black's character. In the end, the decisions paid off for all involved. "Stress Relief" was viewed by nearly 23 million people, making it the most-watched episode of The Office in the show's history.

Why The Office Has So Many Cameos

the office mrs albert hannaday jack black

The Jack Black The Office cameo isn't the only surprise celebrity appearance that has come about on the comedy series, but outside of viewership numbers, why did The Office feature so many celebrity guest appearances? Other actors like Ricky Gervais, Jim Carrey, and Ray Romano have also appeared, and Will Ferrell had a several-episode stint on the show as Michael's short-lived replacement, DeAngelo. Usually, The Office's cameos related directly to the storyline itself, and showrunners were particular about making sure that the cameos were stylized to fit the blue-collar atmosphere of Scranton, Pennsylvania. For example, Ricky Gervais showed up simply because he created the original UK version of The Office. The biggest stunt casting came in the form of the episode "Search Committee," which saw a small group searching for Michael's replacement. The stunt casting in that episode alone cued up the appearance of Will Arnett, Catherine Tate, Ray Romano, Jim Carrey, and James Spader (who had a long run on the series as Robert California). While The Office's celebrity cameos didn't ever veer into overuse territory, they did use the trick often enough and made sure that it almost always fit with the storyline.