“It’s not a felony if you’re doing it for the good guys,” blares the tagline on the poster for American Made, Tom Cruise’s freewheeling new caper of a film about the life of Barry Seal. It’s the kind of sentiment Hollywood loves to celebrate—a rebel breaking the rules for an important cause, or even a patriotic one, as Seal did working off the books for the CIA. What better casting could there be for such a role than Cruise, sporting a shaggy ’70s hairdo and a pair of aviators, executing daredevil pilot moves as he flies around Central and South America? It’s Maverick from Top Gun all over again, just a little grimier.

Except Seal’s life was more than a little grimy—he was a grade-A drug smuggler, a favorite of the Medellín Cartel and Pablo Escobar. Whatever CIA benefactors he served were essentially blackmailing him into clandestine ops to serve shady operations like the Iran-Contra affair. The director Doug Liman takes advantage of Cruise in a fascinating way (much as he did with the star in Edge of Tomorrow, the duo’s last collaboration): by poking at his inherent charisma and peeling it back, mocking the very idea of the American cowboy hero at the center of his boisterous but refreshingly cynical tale.

When we meet Seal, he’s a TWA pilot with a low-level smuggling business on the side, bringing a duffel bag of contraband with him on his flights to score a little extra dough. He’s approached by Monty (Domhnall Gleeson), a CIA agent with a proposition for him: Fly a little propeller plane over rebel bases in Central and South America, take some pictures, and maybe drop off some secret packages for Manuel Noriega, the U.S.-supported military leader in Panama. Good money, off the books, very hush-hush, but all in the name of serving his country.

Seal obliges, and quickly things spiral out of control. Escobar, then on the rise in Colombia, takes note of Seal’s secret flights and demands he start shipping bricks of cocaine on the way back, dumping them out of the air in Louisiana to avoid the DEA. The CIA eventually cottons on but allows the whole thing to continue, as long as Seal can smuggle back some guns for the Contras fighting in Nicaragua. Escobar tolerates that, as long as Seal can operate a whole fleet of cocaine planes to keep his product moving. On and on it goes, with both sides tacitly ignoring the other so that Seal can keep operating extralegally wherever he goes.

Liman and his screenwriter Gary Spinelli tell the tale with all the freewheeling charm required of a caper picture. But American Made never lets the audience forget just how shadily the CIA is behaving throughout, even though Seal is always along for the ride. He has to be—the house of cards he’s built collapses if any of the extralegal organizations he’s working with gets sick of him—and Cruise plays Seal as breezy with just a hint of desperation.

Cruise, one of the last titans of the 1990s who’s still regularly churning out these kinds of star-driven vehicles, already had one flop this year—The Mummy­—in which he strained credulity as a virile, strapping young adventurer. At 55, Cruise is far older than the man he’s playing (who was 40 at the height of his CIA misadventures, though his life story has been significantly smoothed out and Hollywoodized). But Liman uses Cruise’s age mostly to his advantage, playing up the cracks in Cruise’s façade, especially as Seal tries to convince his wife Lucy (Sarah Wright) that his newfound wealth isn’t ill-gotten.

American Made’s best set pieces revolve around Seal’s obvious lie; it’s quite something to watch the smuggler, covered in blood, cheerfully shoving clothes in a garbage bag and telling Lucy they have to leave home before the sun rises. At another point, a drug run gets interrupted by the DEA and Seal ends up ditching the plan in a small town in Louisiana, getting away from the cops on a children’s bicycle while covered in cocaine. It’s been a while since Cruise made a movie this risky, but American Made is exactly that—it’s a story where Ronald Reagan ends up as the ultimate villain, and Pablo Escobar comes across as the most level-headed of Seal’s bosses.

Liman’s visual panache is lacking at times. The action scenes are often shoddily edited, keeping Seal’s daring flights from feeling genuinely thrilling, and whatever late ’70s/early ’80s look he’s aiming for is absent outside of the hairdos. Cruise, for all his live-wire energy (and he has a lot of it), should probably stop making films that so willfully deny his age, even though he’s talented enough to make it work for two hours. But by the time the movie roared to its shockingly grim, remarkably embittered ending, American Made had won me over. Barry Seal, it turns out, isn’t a hero worth rooting for—but neither are the “good guys” handing him the keys to the plane.