There’s always room for a good trashy legal tale on bookshelves and the tube, and on big screens as well. “The Lincoln Lawyer” fills the bill. The cinematic equivalent of an old-fashioned pulp novel, it’s improbable and silly. But while it doesn’t match “Primal Fear” for spellbinding misdirection, it’s certainly a skillfully-made if lightweight legal puzzler.

And it offers Matthew McConaughey his best role in years as slick, cunning L.A. defense attorney Mick Haller, who gets his nickname from using a vintage Continental as his rolling office. Haller handles all sorts of cases, using every trick in the book to win acquittals (and usually succeeding), which—along with his wayward habits—explains why he’s separated from his wife (and assistant D.A.) Maggie McPherson (Marisa Tomei), though the two cooperate in raising their little daughter.

Haller gets an opportunity to increase his bankroll when sleazy bail bondsman Val Valenzuela (John Leguizamo) steers an important case his way—that of rich boy Louis Roulet (Ryan Phillippe), who’s accused of assaulting a prostitute. Though Cecil Dobbs (Bob Gunton), the family lawyer for the real-estate firm headed by Roulet’s mother Mary Windsor (Frances Farmer) is initially doubtful about him, Haller quickly wins him over by demonstrating his smarts, and Mick sets his gruff investigator Frank Levin (William H. Macy, sporting a hilariously huge head of hair) on the trail of exculpatory evidence.

It would be unfair to reveal too much about the twists that the screenplay, adapted by John Romano from a book by Michael Connelly, takes from this point. Suffice it to say that Haller ultimately finds himself in a legal pickle and has to think fast (and engage in some real chicanery) to see that justice is done and his own hide saved. As in some Hitchcock movies, the true villain is revealed halfway through the narrative, but that only means that the plot takes a turn that leads to twists of a different sort.

And though McConaughey carries the major burden, winningly limning a very flawed hero who in the end proves to have a stubbornly righteous streak, the cast is filled with other performers who can also instantly make an impression and cheekily toss around the mostly cynical lines they’re provided with. Phillippe, as his role requires, is mostly a stick, but Tomei, Leguizamo, Farmer, Gunton and Macy are obviously having a ball with their over-the-top characters, and they’re happily joined by Josh Lucas (as the D.A. who prosecutes Roulet), Michael Pena (as an old client of Haller’s), Bryan Cranston (as a homicide inspector), Michael Pare (as another cop), Shea Whigham (as a sleazy courthouse snitch) and Trace Adkins (as the grizzled head of a bicycle gang). Director Brad Furman gives them all plenty of room to operate on the broadest possible canvas—this is less Shakespeare than Jim Thompson, after all. And, with his help of cinematographer Lukas Ettlin and editor Jeff McEvoy, he endows the piece with a grimy atmosphere and energetically keeps the action moving so that you either don’t notice the plot holes or don’t care about them.

And in retrospect, you’re likely to think to yourself that “The Lincoln Lawyer” doesn’t entirely add up. You may even have some nagging questions about why Haller gets hired to defend Roulet in the first place, which by the end appears to have been a bad move (though the defendant’s last name provides a clue, perhaps). But as with so many mystery novels, you’re likely to let all that slide, because the movie is played in such an exuberantly tongue-in-cheek fashion that it becomes a guilty pleasure, entertaining despite—or because of, depending on your point of view—its pulpy character.