It was only a matter of time before the #MeToo movement emerged from behind the scenes to our screens. In fact, so many in and out of Hollywood are grappling with a seismic cultural shift surrounding sexual violence  — or, at the very least, a new urgency to meaningfully address it — that it might have felt disingenuous if TV and film hadn’t acknowledged it somehow. (Not that this is the first time the mediums have tried to address sexual abuse; art, particularly that made by women, has been depicting this kind of struggle for decades without having a handy #MeToo label to make headlines.)

For the most part, TV’s takes on #MeToo have been limited to dramas that have leaned into the weighty gravitas of this reckoning. Shows like “The Good Fight” and “The Romonoffs” weighed the rights of the accusers and accused, to varying degrees of success. Comedies that dip their toes into the murky waters — including “GLOW” and the “Murphy Brown” revival — tend to drop the punchlines in order to focus on the severity of the incidents, letting the stark contrast to their usual rhythms speak volumes.

That’s what makes “Brooklyn Nine-Nine’s” take, which aired February 28, such a startling exception to the rule.

Directed by castmember Stephanie Beatriz, “He Said, She Said” tackles a sexual assault case for the first time in the show’s six seasons. After an obnoxious finance consultant (Jonathan Chase) presses charges against a female co-worker, Keri (Briga Heelan), for breaking his penis (a situation the detectives are thrilled to make fun of until they learn the greater context behind it), Jake (Andy Samberg) and Amy (Melissa Fumero) talk to her and find out that Keri was retaliating against what she insists was an attempted sexual assault. Moved, Amy promises her that they can find a way to hold him responsible — and even encourages her to turn down a $2 million settlement from her firm that would have her sign an NDA, letting both the company and her assailant escape unscathed.

Written out as such, “He Said, She Said” doesn’t sound very funny at all — and to writer Lang Fisher’s credit, the episode never tries to dance around the severity of the situation in order to downplay it. Instead, it weaves punchlines throughout by targeting the gross culture surrounding it. Seth (Chase) and his obnoxious work friends with frat names like “Beefer” (Matt Lowe) do and say whatever they want because they know they can get away with it, and to the detectives’ increasing frustration, the company trains everyone to give the same canned response to their investigation. Crucially, Keri also gets personality traits outside “victim”; she’s pissed and determined, ambitious and matter of fact. (Heelan, a perpetually underrated comic performer, is smart casting here.) When Jake makes what he immediately thinks is an ill-timed joke about Scrooge McDuck, she counters with a deadpan that it is, in fact, her “dream to have a gold coin duck pool.”

At one point, Amy reminds Jake that he and most men have no idea what kind of harassment women endure on a daily basis, triggering a series of quick flashbacks to them both getting treated completely differently while in the exact same situations. Jake’s willingness to learn and understanding that he has less of a stake in a case like this than his wife might comes up in a surprisingly funny twist in a serious scene later on. When Rosa (Beatriz) overhears that Amy encouraged Keri to reject the settlement, she balks, reminding Amy that it’ll be incredibly hard to convict Seth without any physical evidence and to consider the ramifications this might have on Keri’s life. As they trade justifications for their positions, Jake sits in between them, speaking his hesitations about being there out at all loud. (“I feel like I shouldn’t be here”; “or should I be here, because men should be part of the conversation?”; “I’ve landed on active listening, I will no longer be chiming in.”) What he’s saying isn’t particularly hilarious, but the way “Brooklyn Nine-Nine” edits it in quick bites between the otherwise serious conversation punctuates the scene with some necessary levity.

But “He Said, She Said” doesn’t try to force jokes into every scene. In the one discernible outlier, Amy reveals to Jake that the reason she transferred to their precinct in the first place is because her original mentor tried to leverage his position of power over her into sex, causing her to doubt herself and her abilities. It’s as serious a scene as “Brooklyn Nine-Nine” ever gets, reflected in Fumero and Samberg’s grounded, quietly devastated performances. Beatriz, who got one hell of a tricky episode as her directing debut, makes the smart choice to switch up the show’s typical visual style for this scene by going for more close-ups and fewer cuts, letting Fumero in particular take her time with the material.

If there’s any weakness to this episode, in fact, it’s that it overall doesn’t devote as much time to the plot as it maybe should have. The B story of Captain Holt (Andre Braugher) chasing down his most notorious criminal nemesis is fun, but is both too disconnected from the A story and too significant on its own merit to play a supporting role. Other times that “Brooklyn Nine-Nine” has delved into weightier material — as with last season’s “Active Shooter” and season 4’s standout episode “Moo Moo” on racial profiling — the unusually serious subject matter has been the episode’s sole focus, with any B or C stories stemming straight from it. Splitting “He Said, She Said” in two splits the difference in a way that never quite lets either take center stage.

But when all’s said and done, “He Said, She Said” is a pretty impressive new entry into the “TV Tackles #MeToo” canon. It doesn’t sacrifice “Brooklyn Nine-Nine’s” typical structure or joke flow even as it emphasizes the very serious inspiration behind its story. It mocks the people in power, not those who get targeted by them. It grounds everything in its characters, keeping them as sharp and empathetic and smart as the show has made them over the years. If TV is going to keep diving into #MeToo, “He Said, She Said” is a solid road map to use going forward.