An upcoming episode of Fox cop comedy "Brooklyn Nine-Nine" will be taking a cue from longrunning procedural "Castle" -- and also bringing in that series's star for a meta guest role.

Entertainment Weekly has the scoop that former "Castle" star Nathan Fillion is set to appear on the show as Mark Devereaux, described as the "star of a 'Law & Order'-y show titled 'Serve & Protect' ... who thinks he's got the skills to be a detective simply because he played one on TV." Here's the episode synopsis, per EW:

When Jake (Andy Samberg) and Rosa (Stephanie Beatriz) investigate a crime that occurred on the 'Serve & Protect' set, Mark wants to assist the detectives by drawing on his decade of experience playing a detective.

For fans of "Castle," that plotline may sound a bit familiar, since the ABC series -- which was cancelled last year after eight seasons -- revolved around the titular crime novelist, Rick Castle, who became a sleuth himself after teaming with NYPD detective Kate Beckett (Stana Katic) to help solve a recurring series of copycat crimes based on his books. And "Brooklyn" bringing in an actor who's played an amateur detective to play an actor who's played a detective is a brilliant, self-aware bit of casting.

As for how Fillion's character will fare the "Nine-Nine," we have a feeling that Mark and Jake will definitely butt heads. Detective Peralta may not take himself too seriously, but he certainly takes his work seriously, and we can't imagine he'll be too impressed with Mark playing policeman.

No word yet on when Fillion's episode may air. "Brooklyn Nine-Nine" returns from its winter hiatus sometime this spring.

[via: Entertainment Weekly]