Steve Carell's appearance in The Office series finale was a huge surprise to viewers after he repeatedly denying that he would appear in the episode.

Carell told TVLine on Tuesday that lying about his appearance proved to be difficult: "I lied for months to the press, to almost everyone, really. And I felt terribly for the cast and for [executive producer] Greg Daniels, because they all lied, too."

The actor said that he knew "several months" beforehand that he would be returning to play Michael Scott, but he kept quiet "because we just figured it would be a fun surprise if people weren't expecting it." Carell played Michael Scott for the first seven years of The Office before leaving near the end of season 7 to continue his movie career.

Daniels told reporters in months leading up to the May finale that a Carell cameo was not happening, saying, "I think Steve felt, and I agree, that the 'Goodbye, Michael' episode was his goodbye and he didn't want to overshadow the ending that all the other characters deserved."

As seen in the finale, Carell's appearance was brief. Though the show allowed the audience to check in with Michael, most of the finale was devoted to closure for the other characters who have remained on the show since the start.

Carell added, "I didn't want it to be a big thing. I did it out of respect for the show and for the actors. My only hope with it was I didn't want it to be about Michael coming back. I didn't want the story to be about him in any way. I wanted it to be more of a tip of the hat to the show."

Carell's next film will be Despicable Me 2, in which he returns to voice the main character, Gru. The film will come out on July 3.

See Carell's surprise appearance in the Office finale below: