The “Always Sunny” gang is cruel and ridiculous, but also touchingly naïve.Illustration by Andy Friedman

In the fiftieth episode of “It’s Always Sunny in Philadelphia,” two pathetic drunks, Dennis and Mac, brainstorm about an online personal ad for their deadbeat friend Charlie. When they get to his favorite food, Charlie tells them that it’s “milk-steak.” They stare at him, dumbfounded.

“Just put regular steak,” Mac says.

“Don’t put steak, put milk-steak,” Charlie says with confidence. “She’ll know what it is.”

Since it débuted, in 2005, “Always Sunny” has become the milk-steak of sitcoms: the perfect food that no one has ever heard of. In a fairer universe, it would be heralded as not merely the best sitcom on television but one of the most arresting and ambitious current TV series, period. And yet it rarely enters into the Golden Age debates, even as we all yammer on about the latest season of “Homeland.” The creators are not famous; the show has zero Emmys. It probably doesn’t help that, as of this fall, “Always Sunny” airs on a brand-new offshoot of FX, the sketchy-sounding FXX, a cable network whose location on the dial might be described as “go down the road a stretch, look for a church, walk two miles, and it’s in the shack by the abandoned quarry.” (Luckily, old seasons are streaming on Netflix.)

Even among FX-produced comedies, “Always Sunny” has been overshadowed by “Louie,” a one-man show with clearer indie cred and a profile-friendly creator. Yet “Always Sunny,” a more collaborative project, and one that is more overtly sitcom-shaped, is equally deserving. In its ninth season, it is still reliably original, as well as depraved. It’s as unhinged as “Monty Python” but as polished as “30 Rock.” Like a lot of great “white trash” comedy—from “Strangers with Candy” to “Eastbound & Down,” which is currently finishing its own terrific season, on HBO—it looks stupid but is in fact smart. It seems cruel but is secretly compassionate. Mostly, it is very, very funny. Laugh-out-loud funny. At its finest moments, cackling-in-the-basement-while-huffing-glue funny.

The show originated as a project called “It’s Always Sunny on TV,” a low-budget experiment created by Rob McElhenney and Glenn Howerton, who also act in the series. It was a shrewd twist on the TV genre one might call “friendcore”: warm ensemble comedies like “Friends,” “The Big Bang Theory,” “How I Met Your Mother,” and “New Girl,” which center on lovable gangs of buddies and their adventures and romances. Unlike its network analogues, however, “Always Sunny” is set in a dank Irish dive bar called Paddy’s, down an alley in South Philly. Paddy’s is owned and staffed by four losers in their early thirties who know one another from high school: the preening sociopath Dennis (Howerton); his selfish drunk of a twin sister, Dee (Kaitlin Olson); the sad-sack degenerate Charlie (Charlie Day); and the degenerate sad sack Mac (McElhenney). After one low-rated season, FX insisted that the creators hire a star, and they got Danny DeVito, who adds a nicely rank element as Frank Reynolds, the wealthy lowlife who raised Dennis and Dee but is probably Charlie’s biological father.

The show’s unusual approach was apparent from the first episode, which was titled “The Gang Gets Racist” but ended up being about the gang getting homophobic. Over the years, titles have included “Charlie Got Molested,” “The Gang Finds a Dumpster Baby,” “Frank Sets Sweet Dee on Fire,” “The Gang Exploits the Mortgage Crisis,” and “The Gang Solves the North Korea Situation,” as if the writers were determined to destroy the convention of “very special episodes.” This season, in the aftermath of Newtown, the second episode, “Gun Fever Too: Still Hot,” managed to satirize both sides of the gun-control debate in ways that were both funny and insightful, which may be the sitcom equivalent of a perfectly landed quadruple axel at the Olympics. In Season 6, the show also aired television’s most unnerving rape joke, a who’s-on-first dialogue involving the repeated phrase “because of the implication,” a sequence that took as its target the delusional mind-set of the rapist, not the rapee.

This description may make “Always Sunny” sound like some crass, faux-edgy nightmare, like the magazine Vice or Tucker Max. It isn’t. As scurvy as the show’s gags can get, “Always Sunny” is not a nihilistic series—often, it makes actual political points, disguised as acrid satire. Binge-watch episodes, and a gonzo compassion begins to seep up through the filthy surface. The gang is certainly cruel and ridiculous: in a typical episode, Mac and Dee try to put a baby in a tanning machine (“Just to get a base!”), in the hope that it will be cast in ads as Latino. But they’re also touchingly naïve. Even Dennis, a narcissist bully with his own sick “system” for seducing women, has an easily shattered façade. When he goes to his high-school reunion, he’s confident that he’ll be restored to “golden god” status. Instead, he stands alone, fending off “losers,” insisting that “minions” will flock to him. To the actual “cool kids,” he’s as much of an outcast as his friends. In the end, the gang is reduced to fighting their enemies with “Plan B,” which turns out to be a delirious dance number that is filmed, initially, as a “Glee”-type triumph. Then we see what it really is: fat Mac howling, shirtless, his belly bared, as the others jerk and sweat through their fancy clothes.

In this season’s third episode, “The Gang Tries Desperately to Win an Award,” the series addressed its own cult status directly. Why does “Modern Family” win all those Emmys? Why hasn’t the amazing Kaitlin Olson—who gives one of TV’s most radical, down-in-the-dirt slapstick performances—been nominated for best actress? In the episode, Paddy’s is snubbed in a contest for best bar. (“Do you guys think that our location is the problem?”) The gang visits a prize-winning saloon, Sudz, and is horrified by how bright everything is. Two of the bartenders have a syrupy will-they-or-won’t-they flirtation. The sole black “friend” is a blank. “She doesn’t need to be funny,” Dennis explains to Dee, referring to their female server. “She’s cute, she’s lovable, everybody likes her. And then if she can tell a joke, hey, it’s just a bonus.” Back at Paddy’s, they try to follow this recipe, but it all goes wrong, starting with the fact that they attract too many black patrons, the “wrong” kind: “Black bars don’t win awards. I don’t know why, but they don’t,” Dennis says. Mac and Dee’s flirtation ends with him throttling her. Dennis and Mac’s banter becomes unquotably obscene. And Charlie’s “Cheers”-esque theme song devolves into a gloriously surreal diatribe about spiders, punctuated by spitting.

“Always Sunny” isn’t always so self-referential: while it cannibalizes genres, it doesn’t have the abstraction of, say, NBC’s “Community.” But there was something cathartic about seeing the show address, with pride and self-loathing, its own unwillingness to be easily loved. It’s not as if dark shows can’t be popular: “Seinfeld” was a hit, after all. Yet, as impressive as “Seinfeld” was, it had no muck in it. It was icy and calculated, with its anger banked. In part, this was because of who the members of the “Seinfeld” gang were: educated Manhattanites with safety nets. In contrast, the “Always Sunny” characters are gutter punks—mostly Irish-Catholic drunks, although the twins grew up rich, with a Nazi grandfather—with no skills, intractable addictions, terrible families, and little capacity to get anywhere except the Jersey Shore, where they end up fighting over a “rum ham.” They’re not fun drunks: they’re scary, sad ones. As tightly constructed as the show’s jokes can be, the best bits of “Always Sunny” have a serrated aggression, and an air of strangeness and risk. It’s a formula that seems nearly impossible to maintain, let alone keep funny, for such a long run. Maybe “Always Sunny” will never win an Emmy. (“The Wire” never did.) But please watch it or I’ll kill this dog.

Even in its second season, “The Mindy Project,” on Fox, is a bit of a mess, but it’s a spiky, watchable one. Created by Mindy Kaling, the sitcom is about a Manhattan ob-gyn named Mindy Lahiri, a thirty-something yuppie who is convinced that she’s Sandra Bullock or Meg Ryan: a spunky career girl about to meet her soul mate. Yet, despite her insistence that she is gorgeous and sexy, “a petite Asian woman”—when someone implies that her breasts are uneven, she hisses, “How dare you, they’re both huge!”—Dr. Lahiri is no catch out of central casting. She’s pugnacious, she’s self-centered, she’s helplessly shallow. Yet she has the nerve (the sense of entitlement, really) to insist that she’s the star of her own story anyway.

Toward the end of the first season, the show started to jell: it surrounded Lahiri with so many exes and strange prospects that I began to think of it as “The Island of Realistically Hot Men.” She hooked up with a hilarious male midwife, played by the film director Mark Duplass. She began dating a hip minister/d.j. (Anders Holm). There was heat to her dynamic with her Staten Island-bred colleague Danny Castellano (the excellent Chris Messina, who adds heat to every show he’s on, even “The Newsroom”). But in its second season the show still stumbles with its huge ensemble, popping actors in and out like Legos. The working-class nurses are cartoons. There are surreal detours, and little zingers as good as those on any TV show (“Your secret is safe with me,” Mindy tells a colleague, “largely because I don’t care, and I’ll probably also forget”), but they’re nested in misshapen plots.

Yet sometimes my frustration with the show feels indistinguishable from my love for it. “The Mindy Project” may shift queasily from sharp to sour, but, in the formulaic context of network, it’s a haven for strangeness. One of the show’s best qualities is how aggressively it resists the stifling obligations of the ethnic groundbreaker: Lahiri isn’t ever a role model or an underdog. Even in an age of off-putting heroines, she is defiantly idiosyncratic, a new type of character for TV: a second-generation American, Kardashian-addled and Ivy-educated and instinctively offensive, the sort of chick who says that a guy getting beat up is “taking it like he’s the wife in a country-music movie.” In comedy, there’s something to be said for sweet. But rude works, too. ♦