“You’re not the bad guys. WE are.” – Gerard Butler’s badass L.A. County Sheriff’s Dept. lieutenant, roughing up and interrogating a getaway driver played by O’Shea Jackson Jr.

You gotta appreciate the swagger and the ambition of the Los Angeles-based heist thriller “Den of Thieves.”

We get a charismatic cast headlined by Gerard Butler, 50 Cent, O’Shea Jackson Jr. and Pablo Schreiber.

We get some stylish camera moves and a pulsating, tick-tock score designed to keep us on the edge of our seats.

We get to meet some pretty interesting good guys and some fairly colorful bad guys, and sometimes the bad guys are shown to be charming and funny and protective of their families, and sometimes the good guys come across as hot-tempered jerks operating far outside the boundaries of the law — always an enticing recipe for some big-picture “duality of man” type stuff.

And we get an ambitious screenplay with echoes of (far superior) films such as “Heat” and “The Usual Suspects.”

For the first hour or so, it appeared as if writer-director Christian Gudegast’s thriller would turn out to be one of those early-year surprises that catches us off-guard in the best way.

But just when things should have been heating up and kicking into the next gear, the route grew bumpy and meandering and in some scenes drip-drip-drip SLOW — and the last-minute effort to tie up all the loose ends with a twist upon a twist rang hollow and false, and didn’t come close to holding up to post-credits scrutiny.

The opening titles inform us Los Angeles is the bank robbery capital of the world, with a heist occurring every 48 minutes — and sure enough, we’re immediately plunged into a heist, but weirdly enough, it’s not a bank robbery, it’s a takeover of an armored car parked in the lot of a donut shot.

We meet the masked perpetrators only after they’re back in their obligatory warehouse/hideout.

Schreiber’s Merriman is the leader of the gang, which also includes Merriman’s best friend Levi (50 Cent), who served with Merriman overseas; Donnie (O’Shea Jackson Jr.), who seems softer and greener than the rest of the bunch but has mad driving skills, and Bosco (Evan Jones), a tough nut despite being named after a popular chocolate syrup.

Meanwhile, back at the crime scene, Butler’s Nick Flanagan arrives late and hung over and ready with a quip for every occasion. (Sporting an unkempt beard streaked with a little gray, lots of silver man-jewelry, rumpled clothes and blazing eyes indicating he’s a little bit crazy, Butler is going for the full Crazy Mel Gibson Look — and he pulls it off.)

Nick is with the Los Angeles Sheriff’s Dept., but he has his own crew of heavily tattooed, streetwise, bone-cracking tough guys who look more like career criminals than cops — and it appears as if they’re allowed to operate with zero supervision. Oh sure, there’s an uptight, super-square, by-the-book FBI agent known as (I kid you not) “Lobbin’ Bob” Golightly (Jordan Bridges) who is constantly at odds with Nick and his crew, but Nick brushes off the kid like a fly on his shoulder.

Pablo Schreiber (left) and Curtis “50 Cent” Jackson play lawbreakers in “Den of Thieves.” | STXfilm

For a while Nick and Merriman play a high-stakes game of chess with one another. Nick knows all about Merriman and Merriman knows all about Nick — and each one is waiting for the other to make a big move. O’Shea Jackson Jr.’s Donnie becomes a pawn in the game, leaving him bloodied and bruised by both sides, with seemingly nowhere to turn. (“Do we look like the kind of guys that would arrest you?” says Nick. “We’d just kill you. Less paperwork.”)

Of course Nick is married and of course his wife Debbie (Dawn Olivieri, a wonderful actress who’s very strong in just a couple of scenes) has had it with him. (Nick’s treatment of Debbie makes it difficult if not impossible for us to care much about Nick. A scene that seems intent on getting laughs instead comes across as disturbing and creepy.)

We get a much-needed humor break when the 16-year-old daughter of one of the toughest of the tough guys in this film is all dressed up for her first big school dance — and her date meets not only her pops but all of his friends. Never has an 11:30 p.m. curfew been a more certain thing.

Ah, but then it’s back to the battle of wits (and bullets) between Nick and Merriman, leading to an extended sequence that drags on forever and relies on one convenient (and not adequately explained) development after another.

What might have been a slick, smash-mouth, fast-paced piece of entertainment clocking in at 90 or 100 minutes somehow turns into a bloated, half-baked pie that drags on for 2 hours and 20 minutes.

★★

STXfilms presents a film written and directed by Christian Gudegast. Rated R (for violence, language and some sexuality/nudity). Running time: 140 minutes. Opens Friday at local theaters.