Like his debut feature “Nightcrawler,” writer-director Dan Gilroy’s sophomore effort is about a character—or more properly A Character—who practically begs to be inhabited by a star giving the most flamboyant sort of performance. Unlike Louis Bloom, whom Jake Gyllenhaal played so creepily in the earlier picture, however, the titular character of “Roman J. Israel, Esq.” is a decent, principled man, whose uprightness is so abrasive that it often rubs others the wrong way. It’s a showcase role for Denzel Washington, who invests it with his customary vitality and brings a good deal of poignancy to the character’s temporary fall from grace, even though as a whole the picture feels manufactured rather than authentic and the plot goes haywire in the final act.

Israel—who always uses his full name, and at one point sheepishly explains the “Esq.” to a client—is an artifact from the seventies, an aggressively activist lawyer devoted to the cause of social justice. He’s literally living in the past, sporting an Afro, wearing tattered, mismatched coats and trousers and living in an apartment stocked with posters of iconic figures from the civil rights and free speech movements (and lined with thousands of vinyl LPs). He keeps his multitudinous files in paper form, on note cards he can locate immediately as needed, though he has modernized sufficiently to allow for post-its to serve as flaggers.

He also lies, we are directed to assume by the stiff turn he makes onto the steps of his apartment building and his obsessive, repetitive behavior (like calling the code violation office repeatedly to complain of construction noise), somewhere on the autism spectrum. Though not emphasized to the extent that it is in another professional field on “The Good Doctor,” that identifies him as a sort of savant, who can cite case law from memory and has spent years accumulating material for a massive class-action suit against the misuse of plea bargaining, which has put many innocent defendants in prison simply because they could not afford proper defense representation (or bail).

It also explains why Israel has worked for forty years behind the scenes in the small office of William Henry Jackson (whom we never see), a man dedicated to, as Roman puts it at one point, “attempting the impossible for the ungrateful.” Jackson has been doing all the outside tasks—conferring with clients, handling the courtroom appearances—while Israel has been doing all the research, preparing evidence and arguments.

His life is turned upside down, however, when Jackson has a heart attack from which he will probably never recover. Thrust into taking over the office’s cases, Israel proves eloquent but irritating in court, immediately landing him with a contempt citation. He is also confronted by the decision of Jackson’s niece—armed with power of attorney—to close the financially ailing practice down. Everything will be handled by George Pierce (Colin Farrell), a slick former pupil of Jackson’s who now runs an L.A. mega-firm, and who, it turns out, idolized the old man. (He regularly quotes from his classroom dicta—which, though unattributed here, actually come from the works of Voltaire—and was, Roman learns, giving kickbacks to Jackson for cases passed on to him.)

News about Jackson’s darker side impels Israel to reconsider his staunchly ethical practices even as he is being pulled back to his activist past by encountering Maya Alston (Carmen Ejogo), head of the local branch of a community-service lawyer group who will become a potential romantic interest. He will not only join George’s firm but be confronted with a terrible decision involving one of his clients, Langston Bailey (Niles Fitch), who’s being charged with first-degree murder in the death of a convenience store clerk even though the real gunman, Carter Johnson (Amari Cheatom), got away. Bailey tells Israel where Johnson is hiding, information that could serve as a basis for a plea bargain; but there’s a major reward being offered for information leading to Johnson’s arrest. What to do?

Up to this point Gilroy’s film has been an engagingly flashy if admittedly unrealistic portrait of a quirky character, sparked by Washington’s virtuosity, but while the introduction of this plot twist allows the star to add mournful shades to his performance while Israel struggles with his conscience, it also forces Gilroy to work overtime to find some way to end the scenario on a triumphal note while wrapping up all the various subplots. He doesn’t succeed; things go increasingly awry in the final half-hour (there’s a gratuitous car chase that ends with a comic thud, for example), which is not helped by the tendency for the script to italicize the pronouncements of characters about the ethical issues it’s raising,

Still, it’s undeniably enjoyable to watch Washington sink his teeth into such a florid role, even if he can’t always invest it with dramatic credibility. And while Ejogo is saddled with a thankless part, Farrell offers a nifty turn as a guy who inches back toward his law=school idealism even as his inspiration for doing so is straying from it. That’s an interesting juxtaposition, though it’s rather clumsily handled. The film is technically solid, with Robert Elswit’s production design and Kevin Cavanaugh’s cinematography working to capture the L.A. ambience. And the costumes Francine Jamison-Tanchuk has fashioned for Roman prior to his transformation to nattiness are amusingly goofy.

One can enjoy “Roman J. Israel, Esq.” as a pure star vehicle, but as a drama it falls short. And couldn’t at least a bit of credit have been given to Voltaire?