Audiences, as we know, can’t get enough of a great bad guy — the kind we love to hate. The worse he acts, the more we stare. Of course, the fact that we relish a villain doesn’t mean that we’re on his side; getting off on the catchy, scary spectacle of bad behavior isn’t the same as identifying with it. But in “Joker,” Todd Phillips’ hypnotically perverse, ghoulishly grippingly urban-nightmare comic fantasia, Arthur Fleck (Joaquin Phoenix), the mentally ill loser-freak who will, down the line, become Batman’s nemesis, stands before us not as a grand villain but as a pathetic specimen of raw human damage. Even as we’re drinking in his screw-loose antics with shock and dismay, there’s no denying that we feel something for him — a twinge of sympathy, or at least understanding.

Early on, Arthur, in full clown regalia, is standing in front of a store on a jam-packed avenue, where he’s been hired to carry an “Everything Must Go” sign. A bunch of kids steal the sign and then kick the holy crap out of him. The beating fulfills a certain masochistic karma Arthur carries around, but that doesn’t take away from the fact that we feel sorry for him.

“Joker” tells the story of Arthur’s descent (and, in a way, his rise), but it’s clear from the outset that he’s a basket case, a kind of maestro of his own misery. He would like, on some level, to connect, but he can’t. He’s too far out there, like Norman Bates; he’s a self-conscious, postmodern head case ­— a person who spends every moment trying to twist himself into a normal shape, but he knows the effort is doomed, so he turns it all into a “joke” that only he gets.

Arthur’s response to almost everything is to laugh, and he’s got a collection of contrived guffaws — a high-pitched delirious giggle, a “hearty” yock, a stylized cackle that’s all but indistinguishable from a sob. In each case, the laughter is an act that parades itself as fakery. What it expresses isn’t glee; it expresses the fact that Arthur feels nothing, that he’s dead inside. He’s a bitter, mocking nowhere man on the edge of a nervous breakdown.

For all two hours of “Joker,” Arthur, a two-bit professional clown and aspiring stand-up comic who lives with his batty mother (Frances Conroy) in a peeling-paint apartment, is front and center — in the movie, and in our psychological viewfinder. He’s at the dark heart of every scene, the way Travis Bickle was in “Taxi Driver,” and “Joker,” set in 1981 in a Gotham City that looks, with uncanny exactitude, like the squalid, graffiti-strewn, trash-heaped New York City of the early ’80s (you can feel the rot), is a movie made in direct homage to “Taxi Driver,” though there are other films it will make you think of. As the story of a putz trying to succeed as a stand-up comedian, it evokes Scorsese and De Niro’s satirical riff on “Taxi Driver,” “The King of Comedy.” There are also elements lifted from “Death Wish,” “Network,” “V for Vendetta,” “The Empire Strikes Back,” “The Shining” and “The Purge.”

More than that, though, the whole movie, in spirit, is a kind of origin-story riff on Heath Ledger’s performance in “The Dark Knight”: the comic-book villain as Method psycho, a troublemaker so intense in his cuckoo hostility that even as you’re gawking at his violence, you still feel his pain.

Phoenix’s performance is astonishing. He appears to have lost weight for the role, so that his ribs and shoulder blades protrude, and the leanness burns his face down to its expressive essence: black eyebrows, sallow cheeks sunk in gloom, a mouth so rubbery it seems to be snarking at the very notion of expression, all set off by a greasy mop of hair. Phoenix is playing a geek with an unhinged mind, yet he’s so controlled that he’s mesmerizing. He stays true to the desperate logic of Arthur’s unhappiness.

You’re always aware of how much the mood and design of “Joker” owe to “Taxi Driver” and “The King of Comedy.” For a filmmaker gifted enough to stand on his own, Phillips is too beholden to his idols. Yet within that scheme, he creates a dazzlingly disturbed psycho morality play, one that speaks to the age of incels and mass shooters and no-hope politics, of the kind of hate that emerges from crushed dreams.

Arthur and his mother sit around after hours, watching the late-night talk-show host Murray Franklin (played, by De Niro, as a piece of old-school Carson vaudeville), and as much as we think Arthur should move out and leave his mommy behind, we hardly know the half of it. When he gets fired (for revealing a handgun during a clown gig at a children’s hospital ward), there’s a suspense built into everything that happens, and it spins around the question: How will someone this weak and inept, this trapped in the nuttiness of his self-delusion, evolve into a figure of dark power?

At night, on the subway, Arthur, still wearing his clown suit, is taunted and attacked by three young Wall Street players. So he pulls out his gun like Charles Bronson and shoots them dead. The case becomes tabloid fodder (“Killer Clown on the Loose”), and the sensation of it is that the denizens of Gotham think he’s a hero. That sounds like a standard comic-book-movie ploy, but the twisted commitment of Phoenix’s performance lets us feel how the violence cleanses Arthur; doing tai chi in a bathroom after the murders, he’s reborn. And we believe in his thirst for escape, because Phillips, working with the cinematographer Lawrence Sher (who evokes “Taxi Driver’s” gray-green documentary seaminess), creates an urban inferno so lifelike that it threatens to make the film-noir Gotham of “The Dark Knight” look like a video game.

Of course, a rebellion against the ruling elite — which is what Arthur’s vigilante action comes to symbolize — is more plausible now than it was a decade ago. “Joker” is a comic-book tale rendered with sinister topical fervor. When Arthur, on the elevator, connects with Sophie (Zazie Beetz), his neighbor, the two take turns miming Travis Bickle’s finger-gun-against-the-head suicide gesture, which becomes the film’s key motif. It’s a way of saying: This is what America has come to — a place where people feel like blowing their brains out. The relationship between Arthur and Sophie doesn’t track if you think about it too much, but it’s a riff on one that didn’t totally track either — the link, however fleeting, between Travis and Cybill Shepherd’s Betsy in “Taxi Driver.” Arthur, in a funny way, hides his brains (they’re revealed only when he passes through the looking glass of villainy). He’s got a piece missing. But what fills the space is violence.

Many have asked, and with good reason: Do we need another Joker movie? Yet what we do need — badly — are comic-book films that have a verité gravitas, that unfold in the real world, so that there’s something more dramatic at stake than whether the film in question is going to rack up a billion-and-a-half dollars worldwide. “Joker” manages the nimble feat of telling the Joker’s origin story as if it were unprecedented. We feel a tingle when Bruce Wayne comes into the picture; he’s there less as a force than an omen. And we feel a deeply deranged thrill when Arthur, having come out the other side of his rage, emerges wearing smeary make-up, green hair, an orange vest and a rust-colored suit.

When he dances on the long concrete stairway near his home, like a demonic Michael Jackson, with Gary Glitter’s “Rock and Roll Part 2” bopping on the soundtrack, it’s a moment of transcendent insanity, because he’s not trying to be “the Joker.” He’s just improvising, going with the flow of his madness. And when he gets his fluky big shot to go on TV, we think we know what’s going to happen (that he’s destined to be humiliated), but what we see, instead, is a monster reborn with a smile. And lo and behold, we’re on his side. Because the movie does something that flirts with danger — it gives evil a clown-mask makeover, turning it into the sickest possible form of cool.