Patrick Dempsey shocked fans and fellow cast members when he reprised the role of Dr. Derek Shepherd for the season 17 premiere of "Grey's Anatomy." That will not be his first and last appearance, as the actor is in for a multi-episode appearance.

Dempsey talked about his surprise appearance five years after his character was killed off on Wednesday's video interview on "The Ellen DeGeneres Show." He revealed how his return came to be after a conversation with former co-star Ellen Pompeo over the summer.

He said he and Pompeo, who plays Shepherd's widow Meredith Grey, played catch-up since they have not spoken to each other "in quite some time." She suggested an idea for the season 17 premiere of "Grey's Anatomy" which he thought was a great way for the couple to reunite, albeit in a bizarre way.

"She goes, 'What do you think about coming back onto the show? Here's our idea of what we want to do for season 17.' I was like, what a great opportunity for people and how great it would be for the fans, really, to see everybody reunited in this sort of bizarre way," Dempsey explained.

The 54-year-old said goodbye to Dr. Derek "McDreamy" Shepherd in Season 11. He said his return to "Grey's Anatomy" season 17 was under lock and key. No one else knew about it except for Pompeo, ABC, and showrunner Krista Vernoff. The other cast members were as surprised as the fans.

"And then we started talking to the directors, which would be Debbie Allen, who's amazing, and Kevin McKidd, who's one of the directors that I worked with. And that was it," Dempsey revealed and added everyone was surprised when he showed up on set.

Then there was the worry of having to keep his appearance a secret. They were worried someone would take a picture. Thankfully, they "managed to keep it a secret, which was pretty phenomenal." He said the audience response "has been incredibly overwhelming and very moving."

As for how long he is in for "Grey's Anatomy" Season 17, Dempsey played coy. He teased a multi-episode appearance though, when he confirmed that he is on "throughout the season." He said Dr. Derek Shepherd "comes back to visit."

Greys Anatomy
Patrick Dempsey as Derek and Ellen Pompeo as Meredith in the ABC series "Grey's Anatomy." ABC