Over the course of its nine-season run, The Office devastated its viewers with more than a few heartbreaking episodes. Without a doubt, one of the most heartbreaking was season 7’s “Goodbye, Michael,” which marked the final regular appearance of series lead Steve Carell as bumbling regional manager Michael Scott.

RELATED: The Office's 10 Sweetest Moments

Having fallen back in love with Holly while she was covering for a jurying Toby, Michael proposed to her and made plans to move to Colorado with her. As happy as this made him, his last day at the office was pretty bittersweet. So, here are some fascinating behind-the-scenes details from The Office episode “Goodbye, Michael.”

STEVE CARELL WAS CONTRACTED FOR SEVEN SEASONS FROM THE BEGINNING

In an interview with BBC Radio, Steve Carell was asked why he chose season 7 to leave the show. He just decided that it was the right time for Michael to leave TV screens, even if The Office itself wouldn’t do the same for another couple of years.

Carell had always wanted to fulfill his contractual obligations and not break off the contract in the middle of his predetermined commitment to focus on his burgeoning movie career. When Carell first signed on to star in the show when it aired its first season, he was contracted to seven seasons, so he did all seven before departing.

MICHAEL COULD’VE BEEN FIRED FROM DUNDER MIFFLIN

When Steve Carell decided to leave The Office, it meant that the writers had to come up for a reason for Michael Scott to leave Dunder Mifflin. They considered a few scenarios for how Michael would leave, including getting fired by corporate for a serious, unforgivable faux pas.

However, it was later decided that a firing wouldn’t be fun for the audience, so the writers chose to come up with another reason for Michael to leave.

THE ACTORS WERE EVEN SADDER THAN THEIR CHARACTERS

There was a very emotional mood on the set of “Goodbye, Michael,” as the cast members were upset to see Steve Carell go. Apparently, some of the actors got even sadder as themselves than their characters were supposed to be.

While characters like Angela and Darryl wouldn’t be too bothered by Michael’s departure, Carell was a beloved co-worker to the actors playing them, so it was a tricky emotional line to walk.

ANDY BUCKLEY FILMED A GOODBYE SCENE AS DAVID WALLACE THAT GOT CUT

The Office -David Wallace and his suck it hoodie

In the months leading up to the airing of “Goodbye, Michael,” Andy Buckley confirmed that he filmed a scene in which David Wallace wished Michael farewell. However, as the episode was being cut down for network airing, this scene got removed.

RELATED: The Office's 10 Cringiest Episodes, Ranked

The scene was added back in a couple of weeks later when the episode was split into two parts for re-airing. David’s scene was included in the first part of the recut version.

MICHAEL’S TEARFUL FAREWELL TO JIM WAS THE LAST SCENE SHOT BY STEVE CARELL

Jim and Michael shake hands before he leaves

One of the most emotionally charged scenes in “Goodbye, Michael” sees Jim figuring out that Michael is leaving a day earlier than he said he would. With tears in his eyes, Jim tells Michael that he’s been a great boss, and they’ll save their goodbyes for “tomorrow at lunch.”

This was actually the final scene that Steve Carell shot for the episode. It was the last scene he shot in the character of Michael Scott before his surprise reappearance in the series finale.

TOBY’S BROTHER IS PLAYED BY PAUL LIEBERSTEIN’S OWN BROTHER

When Michael is saying goodbye to Toby, Toby mentions that he has a brother named Rory Flenderson who lives out in Boulder, Colorado, the town that Michael is moving to. Toby is played by Paul Lieberstein, who also wrote for the series and was once its showrunner, and Rory was played by Lieberstein’s younger brother, Warren Lieberstein.

The younger Lieberstein is the brother-in-law of producer Greg Daniels and shared an eight-year marriage with Angela Kinsey, better known as Angela Martin.

STEVE CARELL’S CALL SHEET NUMBER WAS RETIRED AFTER HE LEFT

As a farewell gift from the show’s staff, Steve Carell was given a hockey jersey with the number #1 printed on it.

This was Carell’s number on the call sheet, since he was the star of the show, and after he left The Office and the series continued for another two seasons, the number was no longer used on call sheets.

NBC GAVE THE WRITERS FREEDOM TO MAKE THE EPISODE AS LONG AS IT NEEDED TO BE

This episode has an extended runtime of 50 minutes as opposed to the standard of 30 minutes. This was The Office’s first extended episode since season 3’s “Beach Games.”

RELATED: The Office: The Best Episode From Each Season, Ranked

According to producer Greg Daniels, the episode got longer and longer as it was being made, due to the number of goodbyes that Michael had to say to his employees and the unexpected turns taken by Will Ferrell’s performance. NBC boss Robert Greenblatt pretty much gave Daniels the freedom to make the episode as long as it needed to be to be a proper send-off for Steve Carell.

MICHAEL SAYS, “THAT’S WHAT SHE SAID,” AFTER REMOVING HIS MIC

When Michael takes off his microphone at the airport terminal and gives it back to the crew, he says, “This is gonna feel so good, getting this thing off my chest.”

Then, with his mic gone, he speaks another line silently. This line is, of course, his immortal catchphrase, “That’s what she said,” and he can be seen mouthing it if you look closely enough.

PAM’S GOODBYE TO MICHAEL IS ESSENTIALLY JENNA FISCHER’S GOODBYE TO STEVE CARELL

Pam and Michael in The Office

In an homage to Tim’s silent confession of his love for Dawn in the original British version of The Office, Pam’s final goodbye to Michael in the airport in “Goodbye, Michael” is entirely unheard.

On Instagram in May 2018, Jenna Fischer revealed what Pam said to Michael during this scene. Since the dialogue wouldn’t be heard, Fischer said goodbye to Steve Carell as herself and not as Pam, telling him how much his presence would be missed on the set of the show. She said, “Those were real tears and a real goodbye.

NEXT: The Office: 10 Behind-The-Scenes Facts About "Dinner Party"