Superheroes are basically law enforcement personnel in long johns. They swoosh down, capes fluttering, muscles muscling, and apprehend thieves and scoundrels and terrorists, restoring law and order and the status quo. Iron Man polices Afghanistan, Batman polices Gotham; either way, policing is good, and prison for the bad guys is a happy ending. No one whispers “mass incarceration” when Batman tosses the Penguin in the hoosegow.

Suicide Squad is different. The latest entry in DC’s lumbering shared-world screen franchise, directed by David Ayer, is an incoherent trainwreck, even more poorly made than this year’s Batman vs. Superman, which is saying something. But struggling here beneath the spastic flopping of origin stories is a vaguely intelligent effort to try to flip the superhero script. (Spoilers ahead.)

Rather than glorifying the underwear-clad cops, Suicide Squad casts its lot with those staring down the barrel of law enforcement. This is to some extent built into the concept: The Suicide Squad is a group of super-criminals recruited by the U.S. government to do the dirty work of blowing things up in the name of justice. But the film does more than simply send bad guys into battle for good. It works hard to humanize them—which effectively means humanizing prisoners and criminals.

Deadshot (Will Smith) has a daughter, whose letters prison authorities keep from him. Harley Quinn (Margot Robbie) has a twisted but nonetheless heartfelt romance with the Joker (Jared Leto). Most affecting is El Diablo (Jay Hernandez), who killed his wife and children with his fire powers, and who has consequently renounced violence. “I’m a man,” he says when the government tries to recruit him. “I ain’t no weapon.” The police and the government use force, brutality, murder. Diablo, shoved in a metal pipe where he has no room even to stand up, still says no when the U.S. state tells him he has to kill. His dignified embrace of nonviolence easily the most poignant moment in the film, even if it is inevitably squandered. The guy’s got nifty fire powers; you think a superhero film is going to miss out on the opportunity to show him using them?

Suicide Squad also goes out of its way to question the moral authority of law enforcement and military personnel. The prison guards are portrayed as sadistic and marginally competent; they use infractions as an excuse for beatings and torture. The Squad’s military mastermind, Amanda Waller (Viola Davis) is shown shooting civilian clerks in the head because they’ve been exposed to high level security information. She’s certainly got no moral standing to condemn Deadshot, or Harley Quinn, or anyone else.

Finally, the film is surprisingly thoughtful about the way in which prisoners are stigmatized. People hate and fear prisoners, who are often marked for life. Sex offenders have to register with the state long after they’re released; felons lose their right to vote; employers shy away from people who have been in prison. Deadshot, for one, is well aware of this dynamic. He bitterly points out that no matter what happens, or how heroic the Suicide Squad is, they’ll still be blamed for whatever goes wrong. They’re “bad guys,” which is not so much a description as a stereotype and an excuse. You can do anything to bad guys, up to and including forcing them to fight faceless horrors under threat of summary execution via explosives injected into their necks. Criminals have forfeited their rights to freedom, to self-determination and to life.

The film’s paranoid heart is the fear that those who have been oppressed will do to us law-and-order folks what we did to them.

The hatred of prisoners in the film intersects with, intensifies and is justified by hatred of other groups. Most of the Suicide Squad are marginalized in one way or another: Deadshot is black, El Diablo is Latino, Harley Quinn is mentally ill, Killer Croc is physically deformed—and played by black actor Adewale Akinnuoye-Agbaje. When Croc declares, “I’m pretty,” it’s a joke, because his skin is mottled and scaly like a reptile’s. But it’s also a statement of pride. He’s saying that black people, and disabled people, and prisoners, are beautiful, and worthy of love, even if the state and “normal” people hate them.

Still, this is a superhero movie, and while the repressive straight world can be questioned, that questioning can only go so far. Suicide Squad is able to sympathize with Croc and Diablo and Harley Quinn because they’re fighting, however reluctantly, for the U.S. government. The villain, the Enchantress (Cara Delevingne), gets no such sympathy, even though she is in much the same situation.

The Enchantress is an ancient entity who took over the body of an archaeologist. Amanda Waller (Viola Davis) stole the Enchantress’ magical heart and threatens to torture and kill her if she does not obey them. She is a slave, forced to use her powers for military espionage and whatever other tasks Waller sets for her; she’s really the first member of the Suicide Squad, though she goes rogue before anyone else joins the team. The difference between the Enchantress and the others who Waller controls is, simply, that the Enchantress manages to escape, allowing her to seek revenge on her former captors by enslaving them in turn.

The film’s paranoid heart, then, is the terrifying fear that those who have been oppressed will, like the Enchantress, do to us law-and-order folks what we did to them. The hope it holds out is not that the oppressed will gain freedom, but rather that those oppressed “bad guys” will prove to be kinder, more humane, and more heroic than the good guys.

The Enchantress offers the Suicide Squad the opportunity to join her and remake the world, with the oppressed on the top and the oppressors on the bottom. You’d think this would be an appealing vision for the oppressed, but the Squad of course rejects it, choosing to remain loyal to a U.S. government which has literally enslaved them. Despite acknowledging the moral bankruptcy of the status quo, despite showing the humanity and heroism of the marginalized, Suicide Squad simply cannot imagine a better, freer, more just world. This is supposed to be a happy ending?

Suicide Squad is a bad movie in part because Warner Brothers makes bad, incoherent superhero movies, which appear to be assembled by a committee of dour, lightly-stunned actuaries. But it’s also a bad movie because its moral sense and its genre commitments are at odds with each other. Suicide Squad, in its best moments, sees the injustice and cruelty masked by the superhero genre’s law-and-order cowl. In a movie that followed through on those moments, the Enchantress would have destroyed the status quo and set the prisoners free. Instead, the superhero film does its superhero thing, and everyone goes back to their cages, so we can watch the next movie through the same old bars.