“Den of Thieves” is an adrenaline-fueled heist thriller with humor set in the underworld of Los Angeles. Directed by screenwriter Christian Gudegast, the film marks his first outing as a director. “Den of Thieves” lives on parallel narrative tracks, focusing in on a team of gritty, renegade cops, led by Nick Flanagan (Gerard Butler), a humorous and dangerous bruiser, and a group of robbers who are planning to break into the L.A. branch of the Federal Reserve Bank, a fortress of money.

The most impressive thing about “Den of Thieves” is Butler as officer Nick Flanagan. In the first act Flanagan and his ragtag team throw a booze-fueled house party where the guest of honor, shackled to an armchair, is Donnie (O’Shea Jackson Jr.), the driver for the criminal mastermind Merrimen (Pablo Schreiber). They beat what he knows out of him. It’s an illegal set-up, but it’s what they do—it’s who they are. They are police officers and above the law.

In his personal life, Flanagan is in the middle of a collapsing marriage, and his wife

Debbie (Dawn Olivieri) walks out, taking their two young daughters.

Because both sets of men are equally dangerous, it’s hard not to root for the cleverness of the robbers, who are five steps ahead of the questionable cops.

In one scene set inside a Japanese hibachi restaurant, Flanagan enters and makes a deliberate spectacle of himself in front of Merrimen and his crew. He targets Donnie, the driver, revealing that the two have had contact with each other. The story gets iffy here. The movie has already clearly established that Merriman, the gang leader, is cruel and violent with an unforgiving nature. Then why, oh why, would Donnie still be left to live once it’s made clear that he’s connected to the cocky cop. But no: Merriman questions him and is apparently reassured by Donnie’s protests that he got captured and beat up by Flanagan but told him nothing.

This is scarcely a plausible plot twist, and to that end, it’s a death blow to “Den of Thieves”—the film never recovers. It “plays for laughs and action,” yet it defies everything the film has been telling us. And just as Flanagan tips his hand, the lead criminal follows, leaking news of a set-up heist so that Flanagan and his crew will be there in the parking lot, right next to the action yet thrown off the trail.

As the film is long on dialogue and short on action in the third act, the actual robbery isn’t satisfying because the details of how it’s carried out (and then sabotaged) are too vague. Focusing in on Flanagan’s loss of his family is started in the first act and then dropped entirely.

In the end, “Den of Thieves” is clever enough until it’s not.