All Nicolas Cage needed, it seems, was the right script and a great director. He’s starred in so much junk over the past few decade that it became hard to remember what a risk-taker he’d been in his early years. But with a witty screenplay by William Finkelstein and under the practiced hand of Werner Herzog (who’s always done his best work with crazed characters), Cage returns to top form. In “Bad Lieutenant: Port of Call New Orleans,” he’s every bit as magnetic as he was in “Raising Arizona,” “Vampire’s Kiss,” “Wild at Heart” and “Leaving Las Vegas.”

The picture, of course, shares its pre-colon title with Abel Ferrara’s grim, brutal 1992 portrait of a cop’s total meltdown starring Harvey Keitel. But it’s very different. To be sure, Terence McDonaugh (Cage) is hardly a credit to the force in the post-Katrina Big Easy. He’s raucous and reckless on the job when not in sight of his bosses, has a girlfriend on the side who’s also an upscale prostitute, is deeply in debt to his bookie, and takes lots of non-prescription drugs for back pain—which he often gets by shaking down clubgoers using his badge (often taking something else from his distaff victims as well). Still, when handed a case involving the killing of a Senegalese family involved in the drug trade, he takes it seriously, quickly zeroing in on a kingpin called Big Fate (Alvin “Xzibit” Joiner) and his gang.

The solution to the murders, to be honest, is no great mystery. And tracking down the perpetrators is certainly not the main narrative thread, though there’s a prominent (and amusingly nasty) subplot about a witness (Denzel Whitaker) and his protective mother (Irma P. Hall). Rather the focus is on the deepening trouble that McDonaugh finds himself in—with his department, his bookie, a bunch of gangsters and Big Fate’s crew. And as his difficulties grow, he’s dragged into a messy business involving his girlfriend Frankie (Eva Mendes), his ex-cop father (Tom Bower), a recovering alcoholic with a fervent belief in the steps system, and his dad’s beer-swilling, opinionated wife (Jennifer Coolidge). Everything seems to be going even further south than the Gulf, and to save himself he has to make a deal with the devil. But that’s only the beginning, and the surprises that Finkelstein’s script contains involve not the initial case McDonaugh’s working on, but the way in which he worms his way through his own problems.

And that’s where the joy in this “Bad Lieutenant” comes from. You might say that in the end it‘s a story of redemption (the symmetry in the opening and closing of the picture is a joy), but it’s an unearned redemption, even a perversely wrongheaded one. Things turn out in ways you don’t expect, and those absurd twists give the picture a loopy charge, shocking and funny all at once. Far from being the typical action movie Cage has starred in so often, this one turns the genre conventions on their head to often uproarious effect.

Much of the credit for that belongs to Finkelstein and Herzog, of course—the director, after all, has a way with seriously zany stuff—but one can’t even begin to imagine the picture working without Cage. He’s at stage center virtually without pause, and not since “Vampire’s Kiss” has he given a performance that makes such great use of his penchant for bombastic rage and hysteria and his ability to twist his body into comically overdone poses. This is the kind of flamboyant, over-the-top performance that carries all before it, the kind of turn that’s endlessly fascinating in the risks it takes—successfully. Thankfully Herzog gives him free rein—indeed, he probably egged the actor on to go further with every retake—and the result is one of the great over-the-top star turns of recent years.

Nobody else comes remotely close to matching him, but at least they keep up. Mendes doesn’t exactly set the screen afire, but she’s sultry and alluring, as is Fairuza Balk, as a cop whom McDonaugh once partnered with. Joiner plays menace well, and Brad Dourif is all sleaziness as Terence’s bookie, while Coolidge is wonderfully raggedy as his beer-loving stepmom. And if Shawn Hatosy, Vondie Curtis Hall and even Val Kilmer are all pretty much wasted as McDonaugh’s cop cohorts, it’s hard to imagine anybody standing very tall in the presence of the gale winds Cage is constantly throwing off.

Visually “Bad Lieutenant” isn’t much, with spare cinematography by Peter Zetlinger that emphasizes not New Orleans’ glitz but its gritty reality, and one can easily imagine a score that could have contributed more to the proceedings than Mark Isham’s. But largely because of Cage’s outsized turn, the movie is outrageously enjoyable. Anyone going to it expecting a typical cop action movie is bound to be disappointed; but as a witty riff on that genre’s conventions, it’s not bad at all.