Stephanie Beatriz and Andy Samberg in Brooklyn Nine-Nine

Following the end of Castle last year, Nathan Fillion has embarked on a small tour of various networks' single camera sitcoms. It's the sort of tour that might lead one to think the actor is on the lookout for a starring role in a comedy as his next gig -- or that he just really likes the freedom that comes with guest spots. Fillion's first major post-Castle performance brought him to ABC's Modern Family. It was a multi-episode stint in which he played weatherman Rainer Shine, who finds himself caught between a friendship with bumbling patriarch Phil Dunphy and a romantic relationship with Phil's twentysomething daughter Haley. His most recent episode aired at the end of March, but Fillion has been keeping busy with some voice work in Destiny 2 promos, and as self-absorbed TV cop Mark Deveraux on FOX's Brooklyn Nine-Nine.

The character of Deveraux is very much in Fillion's wheelhouse, letting the actor's comedic gifts come bubbling to the surface. As good as he is playing the handsome rogue, Fillion is perhaps even better at playing cocky blowhards utterly lacking in self-awareness. The actor demonstrated as much early this year in Netflix's underrated Santa Clarita Diet, opposite Timothy Olyphant and Drew Barrymore as a couple struggling to come to grips with the fact that she's a zombie. Fillion played a cocky (naturally) real estate agent who didn't let the word "no" ruin his idea of a good time. Needless to say, it made for a memorable one-and-done appearance on the streaming series.

Brooklyn Nine-Nine treats Fillion's role in much the same way, but also manages to deliver a pitch perfect spoof of TV cop shows. The actor's appearance is casual but not too casual; the episode doesn't bank its fortunes on how recognizable its guest star is, but rather on how well he serves the premise. The star of the Law & Order-esque TV show Serve & Protect, Deveraux is convinced he has what it takes to be a real detective because he plays one on TV. Given the prevalence of procedural cop shows and what a salacious, fear-bating nightmare Law & Order: SVU has become, the joke would probably be funny with almost anyone in the role. But considering Deveraux also bears more than a passing resemblance to Fillion's longest-running character, the crime novelist turned NYPD consultant Richard Castle, it's somehow even funnier.

Nathan Fillion in Brooklyn Nine-Nine

What makes Serve & Protect work as an episode, though, is the way it only pays glancing acknowledgment to Fillion's presence. Like most workplace comedies, the show relies entirely on the chemistry of its ensemble. Whether gathered in one place or broken up into smaller troupes – as they are here – Brooklyn Nine-Nine has one of the most reliably funny casts on television. So when a guest star is brought on, he or she doesn't necessarily have to be put in the spotlight. Instead, as is demonstrated with Fillon's Deveraux, there are perhaps more opportunities for humor when a guest actor is used sparingly.

Deveraux is introduced while Jake and Rosa investigate his female co-star's stolen laptop, and Jake is soon seduced by the glitz of showbiz as a producer, played by Greg German, offers them consultant positions on Serve & Protect. Rosa's misanthropy makes her apprehensive of the producer's offer, making him suspect number one in her book. She thinks Jake is being seduced by the real culprit and sets out to prove the producer's guilt, inadvertently (or maybe not so much) crushing Jake's dreams of hobnobbing with the stars and pulling pranks with George Clooney.

At the same time, the episode aims to tackle the ongoing problem of the Nine-Nine potentially being shut down. The precinct is awaiting an evaluation from Veronica Hopkins (Vice Principals star Kimberly Hebert Gregory), who happens to be Terry's grudge-bearing ex-girlfriend. While Amy and Gina try to get to the bottom of what Terry could have done to cause the woman so much grief, Boyle and Captain Holt contemplate blackmailing a senior officer in exchange for a stay of execution for the Nine-Nine. The result is some typically hilarious interplay between Andre Bruagher and Jo Lo Truglio, and another peak into the personal life of the burly feminist played by Terry Crews.

Nathan Fillion Andy Samberg and Stephanie Beatriz in Brooklyn Nine-Nine

Even with a proven scene-stealer like Fillion around, Serve & Protect choses to focus primarily on the looming crisis at the precinct and how the threat of losing the Nine-Nine would have a devastating impact on the lives of the show's main characters. Even Jake and Rosa's subplot eventually finds its way back to the proverbial storm cloud on the horizon, leading to a brief but touching (and literally very briefly touching) moment between the two that illustrates the believability of everyone's friendship.

That leaves Fillion's Deveraux to come back for a handful of funny scenes that primarily serve as a way for the actor to turn his knack for charming arrogance up to eleven without having to carry the episode entirely. It's admittedly a strange place for someone of Fillion's stature, as it really is just a one-and-done guest appearance that's more interested in poking fun at procedural cop show tropes than it is in pointing out the fact that the star of Firefly and Castle is cracking wise with one of the best comedic ensembles on TV today.

It's to the credit of Brooklyn Nine-Nine, then, that the show can capitalize on the appeal and name recognition of someone like Nathan Fillion as a way of reinforcing for the audience what a strong cast it has and how they continue to deliver top-notch comedy week-in and week-out. On the other hand, it's fascinating to see a guy who could (and maybe should) be the star of his own single-camera sitcom come in and deliver a scene-stealing performance in a role that's as relatively small as Mark Deveraux's is.

In the end, Serve & Protect isn't just a vehicle for a guest star to get a few chuckles; it's a clever parody of cop show tropes, right down to the opening credit spoiler of the most recognizable name inevitably turning out to be the guilty party.

Next: Nathan Fillion Says One Great Season of Firefly Was ‘Enough’

Brooklyn Nine-Nine continues next Tuesday with 'The Last Ride' @8pm on FOX